Newbie question - current date - time - PHP

This is a discussion on Newbie question - current date - time - PHP ; 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 ...

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 21

Newbie question - current date - time

  1. Default Newbie question - current date - time

    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

    --
    Thanks - RevDave
    Cool @ hosting4days . com
    [db-lists]

  2. Default Re: [PHP] Newbie question - current date - time


    On Nov 14, 2007, at 12:39 PM, cool7@hosting4days.com wrote:

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





    --

    Jason Pruim
    Raoset Inc.
    Technology Manager
    MQC Specialist
    3251 132nd ave
    Holland, MI, 49424
    www.raoset.com
    japruim@raoset.com

  3. Default Re: [PHP] Newbie question - current date - time

    Hello,

    Use the date function http://us3.php.net/date.

    Regards,
    William Betts

    cool7@hosting4days.com wrote:
    > 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
    >
    > --
    > Thanks - RevDave
    > Cool @ hosting4days . com
    > [db-lists]
    >
    >


  4. Default Re: [PHP] Newbie question - current date - time

    Hi!

    Look at this:

    http://es.php.net/manual/es/function.date.php

    cool7@hosting4days.com escribió:
    > 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
    >
    > --
    > Thanks - RevDave
    > Cool @ hosting4days . com
    > [db-lists]
    >
    >


  5. Default Re: [PHP] Newbie question - current date - time

    On Nov 14, 2007 12:39 PM, cool7@hosting4days.com <cool7@hosting4days.com> wrote:
    > 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
    >
    > --
    > Thanks - RevDave
    > Cool @ hosting4days . com
    > [db-lists]
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >


    <?
    $current_date = date("d/m/Y");
    $current_time = date("H:i:s");
    ?>

    http://www.php.net/date


    --
    Daniel P. Brown
    [office] (570-) 587-7080 Ext. 272
    [mobile] (570-) 766-8107

    If at first you don't succeed, stick to what you know best so that you
    can make enough money to pay someone else to do it for you.

  6. Default Re: [PHP] Newbie question - current date - time

    Check out "date" function.

    <?
    echo date("r", time());
    ?>

    Prints out nice local time, what you need can be made by changing the "r" option. Have a look at the manual for alternatives to "r" liek Y for year, etc...

    so far

    ----- Ursprüngliche Nachricht -----
    Von: "cool7@hosting4days.com" <cool7@hosting4days.com>
    Datum: Donnerstag, November 15, 2007 6:40 am
    Betreff: [PHP] Newbie question - current date - time
    An: php-general@lists.php.net

    > 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
    > functionor how to display it....
    >
    > http://www.php.net/manual/en/function.getdate.php
    >
    > --
    > Thanks - RevDave
    > Cool @ hosting4days . com
    > [db-lists]
    >
    > --
    > PHP General Mailing List (http://www.php.net/)
    > To unsubscribe, visit: http://www.php.net/unsub.php
    >
    >


  7. Default Re: [PHP] Newbie question - current date - time

    At 9:39 AM -0800 11/14/07, cool7@hosting4days.com wrote:
    >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
    >
    >--
    >Thanks - RevDave


    Current date/time for whom?

    For your server, use php's date().

    For the user, use javascript's date().

    It's so cool to be multilingual. :-)

    Cheers,

    tedd

    --
    -------
    http://sperling.com http://ancientstones.com http://earthstones.com

  8. Default Re: [PHP] Newbie question - current date - time

    Thanks Folks,

    The date function worked great!


    --
    Thanks - RevDave
    Cool7 @ hosting4days . com
    [db-lists]

  9. Default Re: [PHP] Newbie question - current date - time

    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

  10. Default Re: [PHP] Newbie question - current date - time

    On Nov 14, 2007 3:19 PM, Jon Westcot <jon@westcot.net> wrote:
    > 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


    Ha! No, it was just a typo on Jason's part.

    Funny stuff though....

    --
    Daniel P. Brown
    [office] (570-) 587-7080 Ext. 272
    [mobile] (570-) 766-8107

    If at first you don't succeed, stick to what you know best so that you
    can make enough money to pay someone else to do it for you.

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast