Log in

No account? Create an account
Oct. 16th, 2008 @ 03:33 pm date/time parameters wtf
I'm really new to PHP and I'm having alot of trouble remembering these date parameters because they seem to make no sense whatsoever.

l: Day of the week. Values Sunday through Saturday ???
F: Normal month representation. Values January through December. ???

Is there something I'm missing or do I simply need to bite the bullet and just memorize what means what?
About this Entry
[User Picture Icon]
Date:October 16th, 2008 08:13 pm (UTC)
(Permanent Link)
You want to look at the on-line PHP manual:


l (lower-case L) is Sunday to Saturday, whereas I returns whether its Daylight time or not.

[User Picture Icon]
Date:October 16th, 2008 08:31 pm (UTC)
(Permanent Link)
I just look them up as needed.

It doesn't help that some of them are slightly different than their strftime counterparts (which just about every other programming language uses).
[User Picture Icon]
Date:October 17th, 2008 01:50 am (UTC)
(Permanent Link)
Agreed. I've memorized the most common one (Y-m-d H:i:s) but if I need anything beyond that I look it up too. It's not even all that often that I need to.
[User Picture Icon]
Date:January 27th, 2009 03:07 am (UTC)
(Permanent Link)
I agree with others here in that I don't even try to remember them and just look them up every time, if needed. However, I have a trick that works for me and that other programmers have taken from me through the years (this problem is not unique to PHP). What I do is set up a file full of date and time examples, either on my own home page or on a local test site, and in this file I include every variation of date and time formatting I've done thus far and a few more besides. Then I can view the output from that file, pick the date format I want and the syntax is right there for me to steal/copy. Building the file teaches you a few tricks and then it's there forever afterward for reference.