Results 1 to 2 of 2

Thread: time...

  1. #1
    Join Date
    Dec 2006
    Posts
    74
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question time...

    hey,

    how would you go about making a php script that does a certain thing if the times is between 2am and 3am?

    all help appreciated

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Date will return the hour if you use the right format.
    http://www.php.net/manual/en/function.date.php

    PHP Code:
    <?php
    $h 
    date('G');
    if (
    $h==2) {
    dostuff();
    }
    ?>
    Or, if you need a bigger timeframe:
    if ($h>2&&$h<12)
    etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •