Re: date format
Re: date format
- Subject: Re: date format
- From: Jan Erik Moström <email@hidden>
- Date: Tue, 27 Nov 2001 18:48:21 +0100
I usually use something like this
on makeFormattedDate(ftype, currentDate)
copy currentDate to b
set month of b to January
if ftype is "YYYY-MM-DD" then
set x to 1 + ((currentDate - b + 1314864) div 2629728)
set shortCreateDate to ((year of currentDate as text) & "-" & x as text) & ,
"-" & day of currentDate
else if ftype is "DD/MM/YYYY" then
set x to 1 + ((currentDate - b + 1314864) div 2629728)
set shortCreateDate to (day of currentDate as text) & "/" & (x as text) &
"/" & ,
text -4 thru -1 of (year of currentDate as text)
else if ftype is "MM/DD/YYYY" then
set x to 1 + ((currentDate - b + 1314864) div 2629728)
set shortCreateDate to (x as text) & "/" & day of currentDate & "/" & ,
text -4 thru -1 of (year of currentDate as text)
else
display dialog "No valid date format defined"
end if
return shortCreateDate
end makeFormattedDate
which allows me to use different date formats without any OSAXs
jem
--
Jan Erik Mostrvm
mailto:email@hidden
Free Elektron
http://www.mostrom.pp.se/folk/jem/