Lazarus

Free Pascal => Beginners => Topic started by: JLWest on July 01, 2020, 09:06:22 pm

Title: Timezone
Post by: JLWest on July 01, 2020, 09:06:22 pm
Trying to implement an example I found  at  https://wiki.freepascal.org/PascalTZ.

Created a directory and installed the timezone "tzdata'.  I get the error in the use clause that it can't find uPascalTZ.

What am I doing wrong.


Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics,
  9.   DateUtils, uPascalTZ, Dialogs;
  10.  
  11. type
  12.  
  13.   { TForm1 }
  14.  
  15.   TForm1 = class(TForm)
  16.     procedure FormCreate(Sender: TObject);
  17.  
  18.   private
  19.  
  20.   public
  21.  
  22.   end;
  23.  
  24. var
  25.   Form1: TForm1;
  26.   PascalTZ: TPascalTZ;
  27.   DateTime: TDateTime;
  28.  
  29. implementation
  30.  
  31. {$R *.lfm}
  32.  
  33. { TForm1 }
  34.  
  35. procedure TForm1.FormCreate(Sender: TObject);
  36. begin
  37.   PascalTZ := TPascalTZ.Create;
  38.   PascalTZ.DatabasePath := 'tzdata';
  39. end;
  40.  
  41. end.
  42.  
Title: Re: Timezone
Post by: Josh on July 01, 2020, 09:31:03 pm
Hi

Did you install the Component Package, note the component is available using OPM.

The TZ icon will appear in the MISC section of your components pallete.


Title: Re: Timezone
Post by: JLWest on July 01, 2020, 09:52:19 pm
No I haven't. I just looked and I thought to add a package to the IDE was under Tools but I don't see it.
Title: Re: Timezone
Post by: winni on July 01, 2020, 10:46:52 pm
Hi!

Hopefully the data base is suffient clever.

There are really strange things in the time zone DB :

Kiribati and  Hawaii are around at the same longitude.

Hawaii is UTC -10 h
Kiribati is UTC + 14 h

Yes! Kiribati is allways 24 h ahead of Hawaii!

And the half-hour-zones getting less but are still present in a lot of coutries like India, Iran, Australia

And don't look for logic . The Central European Time is in reality the area of 3 zones from western Spain to eastern Poland.

Winni
Title: Re: Timezone
Post by: lucamar on July 02, 2020, 08:46:17 am
No I haven't. I just looked and I thought to add a package to the IDE was under Tools but I don't see it.

Not under "Tools", but under "Packages". Just one item to the left ;)
Title: Re: Timezone
Post by: JLWest on July 02, 2020, 08:57:24 pm
@lucanar

Thanks. I kind of gave up on that approach to the problem. I did a demo of the problem and posted it.

Getting a little closer to a solution I hope. 
TinyPortal © 2005-2018