I have to get exact client time. Now i am using javascript date function for that the problem is when user set wrong date for client machine or not set the time, getting wrong. Is it possible to get exact time from client
You can get this by the help of a server side languages like php. Check this Get Client's Accurate date time . Here I used the following functions in php.
geoip_record_by_name();
geoip_time_zone_by_country_and_region();
No,You cannot get the correct date through javascript if the client does not set correct date.Because javascript DateTime functions are reliant on client date time.Instead you can issue an ajax call to the server which fetches you the correct date time string.
Remember get the Time from the ajax call in UTC Format,so that you can convert that UTC format to your local date time using javascript
Javascript cannot provide it to you, but there are two things in the hand:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.