Re: Value of a date in Numbers
Re: Value of a date in Numbers
- Subject: Re: Value of a date in Numbers
- From: KOENIG Yvan <email@hidden>
- Date: Tue, 3 Feb 2009 19:39:04 +0100
Le 3 févr. 2009 à 17:31:49, Luther Fuller a écrit :
On Feb 2, 2009, at 8:41 PM, Michelle Steiner wrote:
value of a cell, when the cell is formated as a time (or date-
time) returns Greenwich Mean Time instead of the local date
displayed in the spreadsheet.
I didn't discover this "feature"; I learned of it from someone
else. But is it a bug or is it as designed?
It does mean that when using that time in other applications, such
as creating an event in iCal, you have to subtract "time to GMT"
from it to get the correct time in the event.
I think this is a feature. (In fact, I would think recording time
locally would be a bug.) Here's why.
The things (files, folders, &c.) on your computer have a date (or
two) associated with them. If you have a portable, these dates may
have been associated with your files in many different time zones.
If you have moved files from other computers onto your computer,
the associated date originates in many different zones.
Dates are mainly used in two ways: to be displayed and to be
calculated. A displayed date should be displayed in the local time
zone. Calculated dates (including date comparison), on the other
hand, need to be independent of any time zone.
In order to avoid always having to convert to some common time
zone, recorded dates should always be in UTC (Coordinated Universal
Time, related to GMT). If you need to compare dates, you just
compare them without having to convert dates.
If you want to display (in a local zone) a date, you will have to
do a conversion.
Dates presented in a Finder Get Info window are displayed in the
local time zone. I don't know if they are recorded in UTC, however.
Does someone know ... ?
The problem is that if we are in a script, date_time generated by
AppleScript are in one format, those grabbed from Numbers are in an
other one.
When it is 18h in France, AppleScript returns 18 in current date but
when we grab the value of a Numbers cell containing 18h we get 19h.
set dd1 to current date
tell application "Numbers" to tell document 1 to tell sheet 1 to tell
table 1
set dd2 to value of cell "B8"
set value of cell "B9" to (dd1 as text)
set dd3 to value of cell "B9"
end tell
log report
tell current application
current date
date "mardi 3 février 2009 19:37:48"
end tell
tell application "Numbers"
get value of cell "B8" of table 1 of sheet 1 of document 1
date "mardi 3 février 2009 20:37:46"
set value of cell "B9" of table 1 of sheet 1 of document 1 to "mardi
3 février 2009 19:37:48"
get value of cell "B9" of table 1 of sheet 1 of document 1
date "mardi 3 février 2009 20:37:48"
end tell
Yvan KOENIG (from FRANCE mardi 3 février 2009 19:38:48)
_______________________________________________
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