Re: Newbie question - current date - time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi:

> > Hi Folks,
> >
> > Newbie question :
> >
> > - how do I get and display the current date?
> > - how do I get and display the current time?
> >
> > I see the getdate function - but I'm not sure if this is the right
> > function
> > or how to display it....
> >
> > http://www.php.net/manual/en/function.getdate.php
>
> Give this a shot:
>
> $Date = date("y/m/d h:m:i");
> echo $Date;
>
> You can format it how ever you want. Lots of different options. Check
> out: HTTP://www.php.net/date for lots more info.

    Um, not to pick nits, and being a newbie myself I'm really risking a lot
here by potentially exposing my ignorance, but was the purpose of the code
above to get the user to read the manual section?  It sure worked for me
when I saw the output of the date command and couldn't believe that the
process I was running completed in just six seconds.  It all boiled down to
changing (dare I say correcting?) "h:m:i" to "h:i:s" -- the "m" in question
related to the month in the date, not minutes in the time.

    And thanks to everyone for being so willing to help and generous with
their time.  I really appreciate it!

    Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux