Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Timestamp gerenation [for php to use]

    Hi, i've been experimenting with this but have yet to find a solution if there is one. Below you can see how far i have come. They both return the time passed since the epoch but still i get different values, any idea why?

    PHP Code:
    <script>
    //UTC() returns milliseconds, mktime returns seconds
    document.write(Date.UTC(1979, 09, 01) / 1000);
    </script>

    <?php
    echo '<br>';
    echo 
    mktime(00009,  011979);
    ?>
    output:
    307584000
    281314800

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    565
    Thanks
    0
    Thanked 18 Times in 18 Posts
    I've used this:
    PHP Code:
    <script type="text/javascript"> 
    //UTC() returns milliseconds, mktime returns seconds 
    document.write(Date.UTC(1979, 8, 0, 23) / 1000); 
    </script> 

    <?php 
    echo '<br>'
    echo 
    mktime(0009,  11979); 
    ?>
    and got the same output from both.

    Seems like Date()'s month and day values are 0-based, and that my server has wrong time zone settings.

    Oh, and use 9 instead of 09, or PHP tries to treat the number as octal (and fail).

    dumpfi
    Last edited by dumpfi; 12-24-2006 at 02:09 PM.
    "Failure is not an option. It comes bundled with the software."
    ....../)/)..(\__/).(\(\................../)_/)......
    .....(-.-).(='.'=).(-.-)................(o.O)...../<)
    ....(.).(.)("}_("}(.)(.)...............(.)_(.))Ż/.
    ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
    Little did the bunnies suspect that one of them was a psychotic mass murderer with a 6 ft. axe.


  •  

    Posting Permissions

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