Re: Coerce time
Re: Coerce time
- Subject: Re: Coerce time
- From: Graff <email@hidden>
- Date: Sun, 30 Nov 2003 20:35:12 -0500
Whups, there is a little error in this code. I wrote "less than 9"
when I meant "less than 10". Here's the corrected form:
---------
set myDate to date "August 20, 2003"
set myShortDate to ""
set theMonth to the (month of myDate) as integer
set theDay to the (day of myDate) as integer
set theYear to (text 3 thru 4 of ((year of myDate) as text))
if theMonth is less than 10 then
set myShortDate to myShortDate & "0"
end if
set myShortDate to myShortDate & theMonth & "/"
if theDay is less than 10 then
set myShortDate to myShortDate & "0"
end if
set myShortDate to myShortDate & theDay & "/"
set myShortDate to myShortDate & theYear
---------
- Ken
On Nov 30, 2003, at 8:25 PM, Graff wrote:
If you specifically want it in the format mm/dd/yy then you need to
parse it out yourself:
---------
set myDate to date "August 20, 2003"
set myShortDate to ""
set theMonth to the (month of myDate) as integer
set theDay to the (day of myDate) as integer
set theYear to (text 3 thru 4 of ((year of myDate) as text))
if theMonth is less than 9 then
set myShortDate to myShortDate & "0"
end if
set myShortDate to myShortDate & theMonth & "/"
if theDay is less than 9 then
set myShortDate to myShortDate & "0"
end if
set myShortDate to myShortDate & theDay & "/"
set myShortDate to myShortDate & theYear
---------
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.