As I have just explained it here :

viewtopic.php?f=5&t=8207
Automagic stored time in android millis. Your timeB is unix epoch in seconds. So you have to times 1000 to get the miliseconds.

You can't use regex to match the time, because timeC will now become a list with content [06:00]. When forced to dateformat, it won't change (don't know why you get "22:00").

Using manual typing time also won't work, because "22:00" is a string, while dateformat expect a number.

You can use the number directly such as

Code: Select all

`time = "{22*3600000,dateformat,hh mm a}"`

But since I use UTC+7, instead of 10 00 PM, this give me 05 00 AM (which is 22 + 7 = 29, then rolldown to 5)

Converting from external source millis or manual calculation is always a problem. You have to know the timezone based for the millis that you get. Most of the time, the external source will output it in UTC+0. So you simply have to add with your timezone.

To get the millis of the timezone, you can use this

Code: Select all

`tz = -getDate("{0,dateformat,z}", "z");`

This get the base 0 timezone and convert it back to time to get the timezone difference in miliseconds. In my case, UTC+7, is 7 hours after UTC+0, so tz is 25200000 here. Add tz up with the millis that you get should get you the correct time you need based on your timezone.

Code: Select all

```
tz = -getDate("{0,dateformat,z}", "z");
timeA = 1566194400;
timeB = timeA*1000;
timeC = timeB + tz;
timeD = "{timeC,dateformat,hh:mm a}";
```

Your method still works for your usage case. Mine save the timeC directly in current timezone, so you can do more calculation later and only output it to "hh:mm a" when needed.