Re: Current date notation
Re: Current date notation
- Subject: Re: Current date notation
- From: Pier Kuipers <email@hidden>
- Date: Thu, 10 May 2001 21:19:29 +0100
Jacco,
To get the different elements of "current date" is simple, for example
set theDay to day of (current date)
--> 10
The problem arises when you get to the month part of the current date:
set theMonth to month of (current date)
--> May
So you'll need a little script step to work out what the month's
number is. There has been a few discussions about how to do this on
this list, but I use a repeat statement to check through a list of
the month names.
Another problem is the leading zero infront of days or months that
are less than 10, so another step is required here. In all, I would
script something like the following:
property theMonthList : {January, February, March, April, May, June,
July, August, September, October, November, December}
set theMonth to month of (current date)
set theDay to day of (current date)
set theYear to year of (current date)
set x to 1
repeat with i from 1 to 12
if (item x of theMonthList) is (theMonth) then
set y to x
exit repeat
else
set x to x + 1
end if
end repeat
if x < 10 then
set x to (0 & x) as text
end if
if theDay < 10 then
set theDay to (0 & theDay) as text
end if
(theDay & "-" & x & "-" & theYear) as text
--> "10-05-2001"
Hope this helps,
Pier.
PS - zijn er veel Applescripters in Nederland?
>
I'm looking for the syntax on current date notation. I want to have
>
the output of "Current Date" as this:
>
>
DD-MM-YYYY
--
Pier Kuipers
Visual ID
* the Media Asset Management solution *
2 Whitefriars
Aungier Street
Dublin 2
Tel. +353 1 476 7059
Mobile +353 87 294 3063
Fax +353 1 478 1366
ISDN +353 1 602 0754
http://www.visualid.com