April 03, 2007

Dates and Times

Your Manage Site page has options to select a timezone for your blog, and to choose formatting options for dates, times, and "datetimes". (A "datetime" is used where both the date and the time should be displayed together.)

The timezone should be self-explanatory; options for formatting dates and times are described in detail below.

Date Formatting Options

Abbreviated weekday name.
Tue, Thu
Full weekday name.
Tuesday, Thursday
Abbreviated month name
Jan, Aug
Full month name.
January, August
Date and time.
Tue Apr 3 14:53:38 2007
Day of month.
Day of year.
%mMonth.1, 8
%UWeek of year (weeks starting Sunday).13
%WWeek of year (weeks starting Monday).13
%xDate (mm/dd/yy).04/03/07
%YYear with century.2007

Time Formatting Options

Hour (24-hour clock).
11, 23
Hour (12-hour clock).
11, 11
03, 29
AM or PM.
15, 59

Some Examples

%A, %B %d
Monday, April 09
%I:%M %p
08:57 PM
%A, %B %d %Y %I:%M %p
Monday, April 09 2007 08:57 PM

Posted by: Pixy Misa at 06:24 AM | Comments (9) | Add Comment
Post contains 182 words, total size 6 kb.

1 I assume the time function doesn't observe DST...?

Posted by: Old Grouch at April 10, 2007 10:18 PM (8vPcQ)

2 Not yet.  I'll be adding support for that later, but it does get pretty complicated.  For now, the best workaround is just to set your timezone forward an hour.  By the time DST is over, I should have the proper support in place to handle that.

Posted by: Pixy Misa at April 10, 2007 10:53 PM (PiXy!)

3 I think I'll just set mine at GMT, and let everybody else figure it out.

Posted by: Old Grouch at April 10, 2007 11:30 PM (8vPcQ)

4 Or change it randomly every few days, that's good too.

Posted by: Pixy Misa at April 10, 2007 11:49 PM (PiXy!)

5 Should there be a time formatting code to include the timezone ?
Probably in a +/-HH format eg "12:28PM (+10)" format

Posted by: Kean at April 14, 2007 02:29 AM (td1Rl)

6 By timezone in that case I meant GMT/UTC offset.  Need ability to handle 1/2 hour offsets too I guess.  You could prompt the site owner for a descriptive TZ like AEST, but that could be confusing.   

Posted by: Kean at April 14, 2007 02:31 AM (td1Rl)

7 That would be nice, but it's a little tricky because of the way timezones are handled (I cheat).  So the standard date/time formatting library I use knows nothing of the timezone.

Posted by: Pixy Misa at April 14, 2007 04:40 AM (PiXy!)

8 I selected Eastern Time US .... but the correct time doesn't appear.  It seems to be stuck on the time when I first accessed it.

Posted by: erp at April 16, 2007 03:20 PM (9oHan)

9 I added a comment, and it seems to be coming up in EST (but not EDT).  What date are you looking at that hasn't changed?

Posted by: Pixy Misa at April 16, 2007 03:36 PM (PiXy!)

Hide Comments | Add Comment

Comments are disabled. Post is locked.
17kb generated in CPU 0.02, elapsed 0.0457 seconds.
38 queries taking 0.03 seconds, 60 records returned.
Powered by Minx 1.1.6c-pink.