Unix Epoch Timestamp zu AppleScript Datum
by hubi on 20/03/2009set einEpochString to do shell script "perl -e 'print time.\"\\n\";'" -- current epoch time as string
epoch2AppleScriptDate(einEpochString)
on epoch2AppleScriptDate(epoch_string)
set h to do shell script "date -r " & epoch_string & " \"+%Y %m %d %H %M %S\""
set mydate to current date
set year of mydate to (word 1 of h as integer)
set month of mydate to (word 2 of h as integer)
set day of mydate to (word 3 of h as integer)
set hours of mydate to (word 4 of h as integer)
set minutes of mydate to (word 5 of h as integer)
set seconds of mydate to (word 6 of h as integer)
return mydate
end epoch2AppleScriptDate
Update (10.11.2010)
Und heute wollte ich unbedingt via AppleScript einen Epoch-Zeitstempel erzeugen und fand hier folgendes:set nowSeconds to ((current date) - (date ("1/1/1970")) - (time to GMT)) as miles as string
No comments yet.