START > APPLESCRIPT > Praktische Handler > Relatives Datum

Relatives Datum

Ermittelt ein relatives Datum per AppleScript. Eine Spende von Martin Wolter (alias «Macmissionar»).

(* ANWENDUNGSBEISPIEL *)
set datum to "17.6.2007  19:24"
set datum to date datum

return my relativzeitanzeige(datum)
-----------------------------------------------------------------------------------------------
on relativzeitanzeige(datum) -- © idea by Martin Wolter 19.12.2005
   set my text item delimiters to ""
   set relativ to {"Vorgestern", "Gestern", "Heute", "Morgen", "Übermorgen"}
   set heute to 3
   try
      set tag to item ((((datum - (current date)) / 86400) as integer) + heute) of relativ
   on error
      set tag to (year of datum & "." & (month of datum as number) & "." & (day of datum)) as string
   end try
   return tag & ", " & (time string of datum)
end relativzeitanzeige
>>> Im Scripteditor öffnen



Powered By CMSimple Design By NMuD Top