hi everybody
i'm trying to dispaly the current date and time in my websie with one of the following codes:
echo date("l F d, Y, h:i:s"); or echo date("l F d, Y, h:i A");
the problem is with the hour; it displays one hour less than the current hour;
at 10 it displays 9, for example;
any ideas; thanks
4 replies to this topic
#1
Posted 17 June 2011 - 06:38 AM
|
|
|
#2
Posted 17 June 2011 - 02:34 PM
date() uses the time on the server - meaning, the server is probably in a different time zone that you are. If you want to get the clients time, you will either have to use JavaScript or have the user manually set their timezone.
As a side note, it is safe to assume that 99.9% of your users will have the time in either their task bar or finder. Thus displaying the time on your website is kind of redundant.
As a side note, it is safe to assume that 99.9% of your users will have the time in either their task bar or finder. Thus displaying the time on your website is kind of redundant.
#3
Posted 18 June 2011 - 05:29 AM
thanks,anyway
#4
Posted 18 June 2011 - 06:57 AM
It might be worth noting that many forums and other websites allow registered users to specify their time zone, to allow the server to calculate the difference between its time zone and the users. The result is every display of a date/time is adjusted on the fly.
#5
Posted 22 June 2011 - 11:42 AM
i have the same problem but the server is at 0000 and im at -0500 and i haven't set up a registration page yet
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









