formatDateHowTo - symfony - Trac
Supported formats for symfony format_date helper

(based on the sfDateFormat::format() method )

This is a date/time format helper. It is i18n aware which means that it's output is affected by the i18n setting of symfony and the current sf_user culture variable. It supports some out of the box formats but can be very flexible. The following listing is a quick reference to all the supported patterns. (It corresponds to symfony 1.2.10).

Out of the box format patterns

These formats correspond to one letter patterns. This is the list of out of the box patterns with example outputs for 2 locales (en, el)

locale: en

d :2010-02-02
D :2 February 2010
p :2 Feb 2010
P :Tuesday 2 February 2010
t :17:58
T :17:58:37 UTC
q :17:58:37
Q :17:58:37 UTC
f :2 February 2010 17:58
F :2 February 2010 17:58:37 UTC
g :2010-02-02 17:58
G :2010-02-02 17:58:37 UTC
i :2010-02-02
I :2010-02-02 17:58:37
M :February 02
m :February 02
R :Tue, 02 Feb 2010 17:58:37
r :Tue, 02 Feb 2010 17:58:37
s :2010-02-02T17:58:37
u :2010-02-02 17:58:37 UTC
U :Tuesday 02 February 2010 17:58:37
Y :2010 February
y :2010 February
locale: el

d :02/02/2010
D :02 Φεβρουαρίου 2010
p :02 Φεβ 2010
P :Τρίτη, 02 Φεβρουαρίου 2010
t :5:58 ΜΜ
T :5:58:37 ΜΜ UTC
q :5:58:37 ΜΜ
Q :5:58:37 ΜΜ UTC
f :02 Φεβρουαρίου 2010 5:58 ΜΜ
F :02 Φεβρουαρίου 2010 5:58:37 ΜΜ UTC
g :02/02/2010 5:58 ΜΜ
G :02/02/2010 5:58:37 ΜΜ UTC
i :2010-02-02
I :2010-02-02 17:58:37
M :Φεβρουαρίου 02
m :Φεβρουαρίου 02
R :Τρι, 02 Φεβ 2010 17:58:37
r :Τρι, 02 Φεβ 2010 17:58:37
s :2010-02-02T17:58:37
u :2010-02-02 17:58:37 UTC
U :Τρίτη 02 Φεβρουαρίου 2010 17:58:37
Y :2010 Φεβρουαρίου
y :2010 Φεβρουαρίου
e.g. format_date( $date, 't') ;

Custom format patterns

The previous one letter format patterns correspond to internal patterns. Instead of a single letter pattern a complete (internal) pattern compiled of the following internal tokens can be provided as input to the format_date. The supported internal tokens are:

Gets the year.
"yy" will return the last two digits of year.
"yyyy" will return the full integer year.
Gets the month.
"M" will return integer 1 through 12
"MM" will return the narrow month name, e.g. "J"
"MMM" will return the abrreviated month name, e.g. "Jan"
"MMMM" will return the month name, e.g. "January"
Gets the day of the week.
"E" will return integer 0 (for Sunday) through 6 (for Saturday).
"EE" will return the narrow day of the week, e.g. "M"
"EEE" will return the abrreviated day of the week, e.g. "Mon"
"EEEE" will return the day of the week, e.g. "Monday"
Gets the day of the month.
"d" for non-padding,
"dd" will always return 2 characters.
"dddd" returns "EEEE" i.e. will return the day of the week, e.g. "Monday"
"G" Gets the era. i.e. in gregorian, year > 0 is AD, else BC.
Gets the hours in 24 hour format, i.e. [0-23].
"H" for non-padding,
"HH" will always return 2 characters.
"a" Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.
Gets the hours in 12 hour format.
"h" for non-padding,
"hh" will always return 2 characters.
Gets the minutes.
"m" for non-padding,
"mm" will always return 2 characters.
Gets the seconds.
"s" for non-padding,
"ss" will always return 2 characters.
"z" Gets the timezone from the server machine.
"D" Gets the day in the year, e.g. [1-366]
Gets day in the month.
"F" for non padding
"FF" will always return 2 chars
"w" Gets the week in the year.
"W" Gets week in the month.
"k" Gets the hours [1-24].
"K" Gets the hours in AM/PM format, e.g [1-12]
e.g. for en culture format_date( $date, 'EEE, dd MMM yyyy') Tue, 02 Feb 2010 which is not in the out the box list :)
format_date  symfony  date 
2 days ago
How to change the font in Sublime Text 2 - makandropedia
How to change the font in Sublime Text 2

Open up your "Base File.sublime-settings" (Preferences Menu → File Settings – User) in Sublime Text 2. Add entries for font_face, and optionally font_size, so it looks similar to this:

{
  "font_face": "Envy Code R",
  "font_size": 11.5
}
Cool: when you save the configuration file, changes will be applied instantly.
sublime-text-2  fonts 
3 days ago
Help, I don't understand STARTTLS or...: Apple Support Communities
Diagnostic-Code: smtp; 530 5.7.0 Must issue a STARTTLS command first
mail  startttls  lion  server 
5 days ago
Romney Economics | Mitt Romney's private sector record
RT : “Mitt Romney takes from the poor … and gives to the rich. He’s just the opposite of Robin Hood.” # ...
from twitter
7 days ago
Clients From Hell
Great collection of outrageous client quotes.
blog  clients  funny  design  humor 
14 days ago
Why Nikola Tesla was the greatest geek who ever lived - The Oatmeal
Amen! RT @abetaha Nikola Tesla, the greatest geek who ever lived:
comic  history  science  tesla 
14 days ago
AWS Developer Forums: Running shutdown scripts ...
"Interesting idea.

For an S3-backed instance, assuming the data was on the root volume, you'd need to actually offload the data during the shutdown sequence.

If the data is on an EBS volume (including an EBS-backed instance) then your shutdown hook could send an SQS message indicating the volume-id where the data is. Another instance could listen for this message, wait for the volume to become available, attach it, and persist the data. Then, if you like, the volume could be deleted.

You'd need a separate SQS queue for each availability zone, and the listeners for that queue would need to be inside that availability zone. This is to ensure the message recipient would be able to attach the volume - which can only be attached to an instance in the same availability zone."
ec2  shutdown  logs 
17 days ago
Amazon DynamoDB for Developers
RT : [Palo Alto] Join us for a DynamoDB deep-dive for developers on May 8th at 5 pm!
from twitter
26 days ago
View Firefox page source in an external editor - Mac OS X Hints
To do this, you need to enter about:config in Firefox's URL bar, then accept the warning when prompted. In the Filter box, type source.editor, which will show you three variables. Double-click on view_source.editor.external first, to change its Value to true. Next, double-click on view_source.editor.path, which will drop down a small sheet in which you enter the path to your preferred editor. The path must be a full complete Unix-style path, and point to the actual executable (not the app bundle).

So for Sublime Text 2 , I used:

/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
firefox  tips  editors  mac  via:deusx 
27 days ago
BBC News - Indian campaign demands 'Right to Pee' for women
BBC News - Indian campaign demands 'Right to Pee' for women
from twitter
5 weeks ago
Rare Bay Bridge lightning strike captured on camera | The Upshot - Yahoo! News
Rare Bay Bridge lightning strike captured on camera | The Upshot - Yahoo! News via
from twitter
6 weeks ago
« earlier      
See this user's network
adobe amazon amazon.com apache aperture api app apple apple-support application apps architecture art article articles astronomy audio aws battlestar-galactica bay-area bbc blog blogs blu-ray books browsers bsg bugs business california car cars comcast comedy community cool css culture delicious desi design dev:setup developer developer.yahoo.com development diy doctrine documentation downloads e-commerce ec2 education effects election2008 email events extensions facebook fcp fe film firefox flickr fonts food football forms forums free freeware funny gallery games geek git github google government graphics hacks hardware hd health help history home home-theater how-tos html5 humor icons image images indian inspiration internet interview ipad iphone iphone:app iPod iTunes itunes-store javascript javascript:effects jquery juku learning leopard lists mac mac:install macosx magazines media microsoft mobile movies music mysql NASA netflix news news.bbc.co.uk obama official open-source performance photography photos photoshop php plugins podcasts politics post-production privacy Programming promise raid redmine reference references research resources reviews safari san-francisco scalability science search security server services shopping smashingmagazine.com social social-media software space steve-jobs support svn symfony symfony2 symfony:plugins sysadmin techcrunch technology tips to:check to:follow to:read to:visit to:watch tools trac travel tutorial tutorials tv twitter ui uk unix utilities utility via:alan.connolly via:algoresult1 via:andysowards via:bernard via:britta via:davedash via:deusx via:dustin.whittle via:justjenfelice via:nosivadnomis via:packrati.us via:popular:hotlist via:stlhood video video-production videos vimeo web web-services web2.0 webdesign webdev webfaction wiki wikipedia windows wired.com wordpress WTF yahoo yahoo! youtube youtube.com yui

Copy this bookmark:



description:


tags: