Android Question [B4X] convert UTC ticks to local time ticks

Alexander Stolte

Expert
Licensed User
Hey,

from my PostgreSQL-Server i receive UTC-Time-Ticks, how can i convert this ticks to the local time ticks?

I have searched in the Forum, but i dont found the right solution...

Greetings
 

emexes

Well-Known Member
Licensed User
from my PostgreSQL-Server i receive UTC-Time-Ticks, how can i convert this ticks to the local time ticks?

I have searched in the Forum, but i dont found the right solution...
DateTime.Now ticks are always UTC. When you use DateTime.Time to get a human-readable string representation of the Long ticks number, it will convert it to the device's local timezone. You can include the letter Z in the DateTime.TimeFormat to check the current timezone offset being used for that conversion.

A useful site for comparing your local DateTime.Now ticks value to UTC, and for doing conversion between local and UTC times (in both directions) is:

https://currentmillis.com/tutorials/system-currentTimeMillis.html
 
Top