简体   繁体   中英

Get clients time as TIMESTAMP from PHP to SQL

I am looking to find out how I can get clients local time as the timestamp when submit is pressed on my form.

My server is hosted in the US and I am in Ireland, have checked if I can change the time but this isn't possible as its a shared server. Can anyone point in the right direction to do the above?

You can set the time zone in your PHP code using the date_default_timezone_set() . The date_default_timezone_set() function sets the default timezone used by all date/time functions in the script. Then use the date() to generate the current date/time in PHP and insert that date/time in the database table.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM