Re: Date-Time Formatting
Re: Date-Time Formatting
- Subject: Re: Date-Time Formatting
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 26 May 2005 18:00:17 -0400
What Gnarlie said. The UNIX date(1) command's time-formatting
feature lets you do whatever you want, even if the field keys are a
little cryptic. You can get a full list by typing "man date" or
"man strftime" in a terminal window, but here are the basics.
set formattedDateString to (do shell script "date +'...format string goes here...'")
where format string can include anything you like, with placeholders for the parts to be replaced by the date values:
%% to get a literal percent sign if you need one
%y to get the two-digit year
%Y to get the four-digit year
%m to get the month number (1-12)
%b to get the short month name (Jan, Feb, Mar,... in English)
%B to get the long month name (January, February, March,... in English)
%d to get the day of the month (1-31)
%H to get the hour in 24-hour time (0-23)
%I to get the hour in 12-hour time (1-12)
%p to get an AM/PM indicator to go with %I
%M to get the minute of the hour
%S to get the second of the minute
%Z to get the time zone label
If you want to throw in the weekday, it's %a for the short name (Sun, Mon, Tue...
in English) and %A for the long name (Sunday, Monday, Tuesday,... in English).
So if you want yyyy/mm/dd it's
do shell script "date +'%Y/%m/%d'"
On 5/26/05, Gnarlodious <email@hidden> wrote:
Entity Jack Stewart spoke thus:
> mm/dd/yyyy date format plus the time-of-day
do shell script "date '+%m/%d/%y@%I:%M:%S %p' "
-- Gnarlie
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
--
Mark J. Reed <
email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden