PDA

View Full Version : Javascript Date - PHP Submission


danielwarner
10-13-2005, 07:35 PM
can anyone help with my problem. i need a script that can take the date and time from someones computer like javascript does but then implement it into a php shortcut e.g: $date_time;

thanks in advance :thumbsup:

mattis2k
10-15-2005, 06:59 PM
There is really only one decent way to do this...

you have to get the date/time from the client in a JS function

then that function has to navigate to a php



var mydate=new Date();
window.location="http://domain.com/mypage.php?mydate="+date;



You can then do as you please in mypage.php using $_GET[date]

danielwarner
10-17-2005, 11:45 AM
im not very good at javascript so can you please talk me through it.

i need this for a guestbook so that i can enter the correct time of someones post into a database.

thanks again.

mrruben5
10-17-2005, 02:01 PM
You should be really using the server side method, because when someone in a different timezone posts, it may appear if they post at the same time, but actually it's a different time!

just use $date=date() in your routine.