Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2006, 12:46 PM   PM User | #1
jeanpaul1979
New Coder

 
Join Date: Dec 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
jeanpaul1979 is an unknown quantity at this point
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
jeanpaul1979 is offline   Reply With Quote
Old 12-24-2006, 01:06 PM   PM User | #2
dumpfi
Regular Coder

 
Join Date: Jun 2004
Posts: 565
Thanks: 0
Thanked 18 Times in 18 Posts
dumpfi will become famous soon enough
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
__________________
"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.

Last edited by dumpfi; 12-24-2006 at 01:09 PM..
dumpfi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:30 PM.


Advertisement
Log in to turn off these ads.