Ich wollte für ein Script Unix-Zeitstempel in ein Apple-Script-Datum konvertieren, und fand bei einer Suche diesen QuelleCode, der anscheinend nur unter englischen System funktioniert.... Nun, deshalb habe ich mir meine eigene AppleScript Routine geschrieben, die mir einfachen Mitteln einen Epoch-Zeitstempel in ein Applescript-Datum umwandelt:
Code zum markieren einmal anklicken
seteinEpochStringtodo shell script"perl -e 'print time.\"\\n\";'"-- current epoch time as string
Unix Epoch Timestamp zu AppleScript Datum
set 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