Convert GMT to IST India Standard Time using javascript

0 votes

I have a date format is GMT or UTC.

var mydate  = '2020-01-14T17:43:37.000Z'

I want to convert this date in IST format so according to this date the output I need in this format.

var date = '2020-Jan-15 12:45'
Nov 4, 2022 in Java by Nicholas
• 7,760 points
21,825 views

1 answer to this question.

0 votes

You can specify an IANA time zone identifier in the options passed to toLocaleString. The identifier for India is Asia/Kolkata.

var s = new Date('2020-01-14T17:43:37.000Z').toLocaleString(undefined, {timeZone: 'Asia/Kolkata'});

The input is in UTC, thus this will convert to the appropriate time zone (as specified by the Z at the end).

answered Nov 7, 2022 by Damonlang
• 700 points

Related Questions In Java

0 votes
1 answer

How to convert a date string to a DateTime object using Joda Time library?

DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = ...READ MORE

answered Jan 9, 2019 in Java by Daisy
• 8,140 points
2,758 views
0 votes
0 answers

How to get the current London time and date using javascript

Using the code below, I attempted to& ...READ MORE

Dec 7, 2022 in Java by Nicholas
• 7,760 points
1,336 views
0 votes
2 answers

How to convert an int array to string using tostring method in java?

Use java.util.Arrays: String res = Arrays.toString(array); System. ...READ MORE

answered Aug 16, 2019 in Java by Sirajul
• 59,230 points
2,541 views
+1 vote
1 answer

Converting a date string to a DateTime object using Joda Time library

Use DateTimeFormat: DateTimeFormatter formatter = DateTimeFormat.forPattern("dd/MM/yyyy HH:mm:ss"); DateTime dt = ...READ MORE

answered Jul 24, 2018 in Java by scarlett
• 1,290 points
5,150 views
0 votes
0 answers

How to get the Australian Time Zone using Javascript?

I am trying to help a friend ...READ MORE

Jul 19, 2022 in Web Development by gaurav
• 23,260 points
1,379 views
0 votes
1 answer

Differentiate between Tokyo and Seoul Time zone

if DST and Offset are the only ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,600 points
688 views
0 votes
1 answer

How do I get the current date in JavaScript?

To ensure that you get the current ...READ MORE

answered Feb 18, 2022 in Java by Aditya
• 7,680 points
700 views
0 votes
1 answer

Parsing a string to a date in JavaScript

The best string format for string parsing ...READ MORE

answered Feb 18, 2022 in Java by Aditya
• 7,680 points
757 views
0 votes
1 answer

How to decode jwt token in javascript without using a library?

Working unicode text JWT parser function: function parseJwt ...READ MORE

answered Nov 4, 2022 in Java by Damonlang
• 700 points
7,755 views
0 votes
0 answers

What's the best way to convert a number to a string in JavaScript?

What method is the "best" for convert ...READ MORE

Nov 8, 2022 in Java by Nicholas
• 7,760 points
464 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP