Newbie: Coercing Month of date class to a number
Newbie: Coercing Month of date class to a number
- Subject: Newbie: Coercing Month of date class to a number
- From: "Casey ,Mr Damon" <email@hidden>
- Date: Wed, 20 Feb 2002 15:10:02 -0000
Hi,
I am writing a script that puts the date into a filename as a UK date eg:
20/02/2002. I have read up in Danny Goodman's book and also the recent
O'Reilly book and have found no way of doing this directly using "current
date" in the Standard Additions OSAX..
I have been able to do it using the following code:
set month_of_current_date to month of (current date)
if month_of_current_date = January then
set month_as_digits to "01"
else if month_of_current_date = February then
set month_as_digits to "02"
else if month_of_current_date = March then
set month_as_digits to "03"
else if month_of_current_date = April then
set month_as_digits to "04"
else if month_of_current_date = May then
set month_as_digits to "05"
else if month_of_current_date = June then
set month_as_digits to "06"
else if month_of_current_date = July then
set month_as_digits to "07"
else if month_of_current_date = August then
set month_as_digits to "08"
else if month_of_current_date = September then
set month_as_digits to "09"
else if month_of_current_date = October then
set month_as_digits to "10"
else if month_of_current_date = November then
set month_as_digits to "11"
else if month_of_current_date = December then
set month_as_digits to "12"
end if
set day_of_current_date to day of (current date)
set year_of_current_date to year of (current date)
set new_document_name to "Example " & day_of_current_date & "/" &
month_as_digits & "/" & year_of_current_date
Is there an easier way of doing this directly using "current date", or is
this the only way of doing it, or should I use a repeat loop?
Regards,
-
Damon Casey
Systems Support
Publishing Department
The Wellcome Trust, 210 Euston Road, London NW1 2BE
Tel: 020 7611 8718 Fax: 020 7611 8242 E-mail: email@hidden
The Wellcome Trust is a registered charity, no. 210183.
Its sole Trustee is The Wellcome Trust Limited, a company registered in
England, no. 2711000, whose registered office is 183 Euston Road, London NW1
2BE.
_______________________________________________
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.