0

I'm trying to convert the time from AEST to IST. Not sure whether this approach is correct. My question with the below code is how can I deduct the date by 1 if the time shifts to the previous day?

The output should result : Thu Aug 24 2022 07:45:00

const date = 'August 25, 2022 12:15:00' // GMT+1000 (Australian Eastern Standard Time)" in 24 hours format

var IST = new Date(date); 
IST.setHours(IST.getHours() - 5); 
IST.setMinutes(IST.getMinutes() + 30);

console.log(IST.toString())
user2824374
  • 168
  • 3
  • 14
  • https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript – Đào Minh Hạt Aug 25 '22 at 03:27
  • Does this answer your question? [Convert date to another timezone in JavaScript](https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript) – ray gan Aug 25 '22 at 03:27
  • adding this line before console.log ```IST.setDate(IST.getDate() - 1)``` – naif_d Aug 25 '22 at 03:30

0 Answers0