Bluehost.com Web Hosting $6.95

date problem

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", ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-24-2003
Shaun
 
Posts: n/a
Default date problem

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
Reply With Quote
  #2 (permalink)  
Old 09-24-2003
John
 
Posts: n/a
Default Re: date problem

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

Reply With Quote
  #3 (permalink)  
Old 09-24-2003
Robert Cummings
 
Posts: n/a
Default Re: [PHP] Re: date problem

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. |
`------------------------------------------------------------'
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:18 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0