0

I want to set the Timezone for Date picker in java script. It seems it always takes time from the browser which is running on it.

For e.g My OS Date is set to : July 5,2015

Current Date: 24 Oct 2015

Whenever i try to open the Date Picker. It shows July 5,2015 as current date instead of the Oct 24,2015.

RahulRaj
  • 39
  • 1

1 Answers1

0

JavaScript runs on the client machine, as such it will get the date from the client machine. If your machine is not configured correctly (as it sounds yours is not), the date returned will be incorrect. You need to query whatever server you trust to have the correct date and use that result.

There are also Free APIs that serve up the time if you don't want to use your own server all over this post: Free Rest API to get current time as string (timezone irrelevant)

Community
  • 1
  • 1
Joseph Duty
  • 775
  • 5
  • 14