Yousha Rizvi
Yousha Rizvi

Reputation: 35

UTC TO GMT Conversion in Javascript

I need to convert UTC/Local time to GMT+(?) format on requested timezone... eg..

UTC to GMT 0
UTC to GMT+1
UTC to GMT-1
UTC to GMT+5
UTC to GMT-5
GMT+5 to GMT+4
GMT+5 to GMT-3

Upvotes: 0

Views: 8469

Answers (2)

shruthics
shruthics

Reputation: 21

var inputDateTime = "Thu Sep 24 2015 15:00:00 GMT+0530 (IST)";
var date = new Date(inputDateTime );
var GMTtime= ((date.getUTCMonth() + 1 ) + '/' + date.getUTCDate() + '/' + date.getUTCFullYear()+ ' ' + date.getUTCHours()+ ':' + date.getUTCMinutes()+ ':' + date.getUTCSeconds()+" GMT");

Upvotes: 2

Ed Heal
Ed Heal

Reputation: 60007

UTC is GMT for most practicable purposes. We (the English) invented it. Just add/subtract the hours.

Please visit Greenwich. Just outside london.

Upvotes: 0

Related Questions