0

I need the current Date Time from where the user of my website filling a <form/>. The Date-Time should be user's Time Zone
I need to get the DateTime without setting the TimeZone

When I use

date("Y-m-d H:i:s")

It only returns DateTime in IST. whether user is from India,USA or UK.

I need the current Date-Time from the User's TimeZone.

I need to insert the value to datetime field in MySql

I didn't ask for user timezone , rather I need the date and time from user's time zone

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
Sourav Sarkar
  • 292
  • 3
  • 20

1 Answers1

1

You've got at least two fast solutions:

  1. browsecap or http://smart-ip.net/geoip-api this api returns timezone corresponding to your user IP address
  2. you can use javascript and send info about date to your php script:

    new Date().getTimezoneOffset(); - timezone offset :) new Date().toString() - returns Sat Jun 11 2016 20:04:35 GMT+0200 (CEST)

PawelN
  • 339
  • 2
  • 9