Show the epoch: Difference between revisions

m
(Added AppleScript.)
m (→‎{{header|AppleScript}}: Typo correction.)
Line 56:
use scripting additions
 
local CocoEpochCocoaEpoch, UnixEpoch
 
-- Get the date 0 seconds from the Cocoa epoch.
set CocoEpochCocoaEpoch to current application's class "NSDate"'s dateWithTimeIntervalSinceReferenceDate:(0)
-- The way it's rendered in its 'description' is good enough for the current purpose.
set CocoEpochCocoaEpoch to CocoEpochCocoaEpoch's |description|() as text
 
-- Get the date 0 seconds from the Unix epoch and format it in the same way.
set UnixEpoch to (do shell script "date -ur 0 '+%F %T %z'")
 
return "Cocoa epoch: " & CocoEpochCocoaEpoch & linefeed & "Unix epoch: " & UnixEpoch</lang>
 
{{output}}
557

edits