This is a discussion on date problem within the PHP General forums, part of the PHP Programming Forums category; Hi, Why does the following code print '00', surely it should print '08', I'm baffled! date("H", ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
For me, on Windows, it won't work because Windows won't do anything prior to
1970. On linux, I get 17 as the result. If I change the year to 2000, then I get 08 on both. John "Shaun" <shaun@mania.plus.com> wrote in message news:20030924160719.11919.qmail@pb1.pair.com... > Hi, > > Why does the following code print '00', surely it should print '08', I'm > baffled! > > date("H", mktime(8, 0, 0, 0, 0, 0)); > > Thanks for your help |
|
|||
|
From the documentation:
http://ca2.php.net/manual/en/function.mktime.php "Date with year, month and day equal to zero is considered illegal (otherwise it what be regarded as 30.11.1999, which would be strange behavior)." I think the point here to think about is that the date(), time(), and mktime() functions all work with timestamps which happen to all function with respect to the Unix Epoch (January 1 1970) Cheers, Rob. On Wed, 2003-09-24 at 13:26, John wrote: > For me, on Windows, it won't work because Windows won't do anything prior to > 1970. > > On linux, I get 17 as the result. If I change the year to 2000, then I get > 08 on both. > > John > > > "Shaun" <shaun@mania.plus.com> wrote in message > news:20030924160719.11919.qmail@pb1.pair.com... > > Hi, > > > > Why does the following code print '00', surely it should print '08', I'm > > baffled! > > > > date("H", mktime(8, 0, 0, 0, 0, 0)); > > > > Thanks for your help > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- ..------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------' |