Recent

Author Topic: How get timezone information in Lazarus on Android  (Read 264 times)

las

  • New Member
  • *
  • Posts: 22
How get timezone information in Lazarus on Android
« on: May 16, 2019, 11:35:51 pm »
Hi!
Help me, please, how to get local time.

The "Now" and "systemtimetodatetime" functions return UTC time.

How to find out the current TimeZone?

jmpessoa

  • Hero Member
  • *****
  • Posts: 1421
Re: How get timezone information in Lazarus on Android
« Reply #1 on: May 17, 2019, 01:22:28 am »

You can try:

Code: Pascal  [Select]
  1. ...........................
  2. var
  3.    dateTime: string;
  4. begin
  5.    ...............
  6.    dateTime:= Self.GetDateTime();  //yyyy-MM-dd HH:mm:ss
  7.    ....................
  8. end;
  9.  

Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

las

  • New Member
  • *
  • Posts: 22
Re: How get timezone information in Lazarus on Android
« Reply #2 on: May 17, 2019, 01:27:12 am »
Thanks. It work

RAW

  • Hero Member
  • *****
  • Posts: 785
Re: How get timezone information in Lazarus on Android
« Reply #3 on: May 17, 2019, 01:31:02 am »
GetSystemTime
SystemTimeToTzSpecificLocalTime
TTimeZoneInformation
GetTimeZoneInformationForYear

// Windows only ...  :)
Windows 7 Pro (x64 Sp1) And Windows XP Pro (x86 Sp3) - LAZARUS 2.0.4 FPC 3.0.4 - TRUNK 2.1.0 FPC 3.3.1