Recent

Author Topic: cet/ usa time conversions  (Read 2237 times)

frederic

  • Full Member
  • ***
  • Posts: 226
cet/ usa time conversions
« on: June 04, 2015, 04:45:21 pm »
dear specialists

 
i am looking for standard procedure  which calculates new york time derived from of central european time.
The procedure should take care of the several summer/wintertime transfers
I expected to find this in lazarus but could not find it.

Is there someone to give an hint?

frederic

kpeters58

  • Sr. Member
  • ****
  • Posts: 267
Re: cet/ usa time conversions
« Reply #1 on: June 04, 2015, 08:29:12 pm »
You will most certainly not find anything that "calculates new york time derived from of central european time"

To convert between Eastern Time and CET look here:

http://wiki.freepascal.org/PascalTZ

Lazarus 2.0.4/FPC 3.0.4/Win 64

balazsszekely

  • Guest
Re: cet/ usa time conversions
« Reply #2 on: June 04, 2015, 09:18:35 pm »
@frederic

The difference between CET and NYT is six hours.
Code: [Select]
procedure TForm1.Button1Click(Sender: TObject);
var
  CET, NYT: TDateTime;
begin
  CET := Now;
  NYT := IncHour(CET, -6);
  ShowMessage('Time in Europe: ' + FormatDateTime('DD.MM.YYYY  hh:mm:ss', CET) + sLineBreak +
              'Time in New York: ' + FormatDateTime('DD.MM.YYYY  hh:mm:ss', NYT));
end;

PS: To take into account the daylight saving, please read this: http://delphiforfun.org/programs/math_topics/dstcalc.htm
Quote
USA starting in 2007, extended DST to begin on the 2nd Sunday in March (Day of month = 14 - (1+Y*5/4) mod 7) and end on the 1st Sunday in November (Day of month = 7 - (1 + 5*Y/4) mod 7).
For Europe, DST begins on the last Sunday in March (Day of month = 31 - (4+ 5*Y/4 ) mod 7) and ends on the last Sunday in October (Day of month = 31 - (1 + 5*Y/4) mod 7
You have 4 formula. It shouldn't be to difficult to make the necessary adjustments.
« Last Edit: June 04, 2015, 09:38:02 pm by GetMem »

frederic

  • Full Member
  • ***
  • Posts: 226
Re: cet/ usa time conversions
« Reply #3 on: June 06, 2015, 05:00:23 pm »
thanks for your reactions

it looks that i will use pascalTZ for my application

frederic

 

TinyPortal © 2005-2018