-1

I have a time from the server with returns

2022-10-16T13:17:05.885+00:00

The time zone is 'Asia/Manila'. This time represents October 16, 2022, 9:17pm

I want to convert this time to be read as October 16, 2022, 9:17pm, or the same as 'Asia/Manila' even if the client computer is of different time zone, e.g. 'Asia/Tokyo' or any other time zone automatically.

Here's what I have tried so far.

  1. Convert Asia Manila Time to UTC

    const utcDate = DateTime.fromISO('2022-10-16T13:17:05.885+00:00').toUTC().toISO();
    
  2. Convert UTC Date to Client timezone:

    const convertedDate = DateTime.fromISO(utcDate).setZone('Australia/Darwin');
    

The converted date returns: October 16, 2022, 10:47 PM My desired result is October 16, 2022, 9:17pm or the same time as it is in the 'Asia/Manila'

I am using Luxon and I haven't figured it out yet for months searching for answers

VincenzoC
  • 30,117
  • 12
  • 90
  • 112
Markus
  • 85
  • 9
  • As already stated by others, since input time contains `+00:00` it represent a time in UTC not in Asia/Manila. – VincenzoC Oct 17 '22 at 07:15

1 Answers1

1

I hope this is what you are looking for,

const date = DateTime.fromISO('2022-10-16T13:17:05.885+00:00').setZone('Asia/Manila');

output,

2022-10-16T21:17:05.885+08:00
  • The time 2022-10-16T13:17:05.885+00:00 is already at timezone 'Asia/Manila', when the client computer is using timezone example: 'Asia/Srednekolymsk' or 'Australia/Darwin', both should be able to return October 16, 2022, 9:17pm or the same time as it is in the original timezone – Markus Oct 16 '22 at 14:00
  • 1
    2022-10-16T13:17:05.885+00:00 this is in UTC not 'Asia/Manila' timezone. So you have to convert this to 'Asia/Manila' timezone. So for example: 'Asia/Srednekolymsk' or 'Australia/Darwin' will see October 16, 2022, 9:17pm. – Haritha Senevirathne Oct 16 '22 at 17:13
  • 2022-10-16T13:17:05.885+00:00 is 'Asia/Manila' time zone. That is my time zone. That is the time generated from the server – Markus Oct 17 '22 at 02:31
  • 1
    frankly, when +00:00 is added to the end of the time, it is UTC. – Haritha Senevirathne Oct 17 '22 at 02:35