Re: TIME TO GMT and Summer time
Re: TIME TO GMT and Summer time
- Subject: Re: TIME TO GMT and Summer time
- From: KOENIG Yvan <email@hidden>
- Date: Sat, 09 Jul 2011 19:59:47 +0200
Le 9 juil. 2011 à 19:27, Randal L. Schwartz a écrit :
>
>>>>>> "KOENIG" == KOENIG Yvan <email@hidden> writes:
>
> KOENIG> As I already wrote here, when I extract a date_time value from a
> KOENIG> Numbers cell and insert it in an other cell, I must subtract the
> KOENIG> value TIME TO GMT because when a cell display 1943/12/31 00:00
> KOENIG> 00 the extracted value, here in France is 1943/12/31 01:00:00
>
> KOENIG> Alas, as we are in summer, TIME TO GMT is not 3600 but 7200 so
> KOENIG> the corrected value is wrong.
>
> Uh, 1943/12/31 is North Hemisphere winter, not summer. France winter is
> UTC+1, according to the sources I see.
>
> Try it again with 1943/6/1 and you would (hopefully) see a 2-hour
> offset.
I know that but the date stored isn't 1943/6/1, it's 1943/12/31 .
I can't change my birthday.
Numbers correctly send 1943/12/31 01:00:00 to AppleScript but, the problem surface when I want to insert this value in an other cell.
If I insert the extracted value, the target cell contain : 30 déc. 1943 23:00
because the function TIME TO GMT returns the value applying today.
It doesn't accept a parameter.
Here is the script used to test :
--{code}
tell application "Numbers" to tell document 1 to tell sheet 1 to tell table 1
tell cell "B16"
set maybe to value
set maybef to format
end tell
if class of maybe is date then
set maybe2 to maybe - (my time_to_GMT())
set maybe3 to date string of maybe
end if
tell cell "D14"
set value to (maybe as text)
set format to maybef
end tell
if class of maybe is date then
tell cell "D15"
set value to (maybe2 as text)
set format to maybef
end tell
tell cell "D16"
set value to (maybe3 as text)
set format to maybef
end tell
end if
end tell
on time_to_GMT()
return time to GMT
end time_to_GMT
--{code}
The problem is annoying because my true birthday is 1943/12/31 23:55 (nobody's perfect)
AppleScript extracts it as "samedi 1 janvier 1944 00:55:00"
In D14, I get 1 janv. 1944 00:55
in D15, I get 31 déc. 1943 22:55
In D16, I get 1 janv. 1944
None of them is satisfying.
Trying an other wording to my question, is it a way to get the value TIME TO GMT applying to a given date ?
At this time, the only way to pass the date_time correctly is to store it as a string which is really boring.
Yvan KOENIG (VALLAURIS, France) samedi 9 juillet 2011 19:58:32
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden