Guest
2010-12-31, 04:42 PM
The other thing which may be useful to understand is the relationship between Applescript dates and the numeric datestamp strings in the cache. (Representing dates as a count of seconds since midnight at the start of 2001).
Here is a simple conversion function:
Code:
property pdteBase : missing value
on SQL2ASDate(strDateStamp)
try
set intDate to (strDateStamp as integer)
on error
return missing value
end try
if pdteBase is missing value then
set pdteBase to current date
tell pdteBase
set {its year, its month, its day, its time} to {2001, 1, 1, 0}
end tell
end if
(pdteBase + intDate) as string
end SQL2ASDate
on AS2SQLDate(strDate)
try
set varDate to date strDate
on error
return "null"
end try
if pdteBase is missing value then
set pdteBase to current date
tell pdteBase
set {its year, its month, its day, its time} to {2001, 1, 1, 0}
end tell
end if
(varDate - pdteBase) as string
end AS2SQLDate
Last edited by RobTrew; 2011-01-01 at 12:24 AM..
Reason: Added function for conversion from cache datestamp strings to AppleScript dates