Re: Date trouble
Re: Date trouble
- Subject: Re: Date trouble
- From: Yvan KOENIG <email@hidden>
- Date: Sat, 21 Oct 2006 08:24:41 +0200
Hello
Here are plain vanilla codes.
Version 1 for Mac OS X 10.4 and higher:
set cd to my normalize(current date)
log cd
on normalize(d)
return "" & year of d & ":" & my pad((month of d) as number) & ¬
":" & my pad(day of d) & " " & my pad((time of d) div 3600) & ¬
":" & my pad(minutes of d) & ":" & my pad(seconds of d)
end normalize
on pad(n)
return text -2 thru -1 of ("00" & n)
end pad
Version 2 for older OSs
set cd to my normalize(current date)
log cd
on normalize(d)
set tt to (time of d)
set hh to (tt div 3600)
set mi to (tt div 60) - (hh * 60)
set ss to (tt mod 60)
return "" & year of d & ":" & my pad((month of d) as number) & ¬
":" & my pad(day of d) & " " & my pad(hh) & ¬
":" & my pad(mi) & ":" & my pad(ss)
end normalize
on pad(n)
return text -2 thru -1 of ("00" & n)
end pad
I used them for years with no problem.
Yvan KOENIG _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden