Re: Shell script date & time coercions...
Re: Shell script date & time coercions...
- Subject: Re: Shell script date & time coercions...
- From: Applescript User Kreme <email@hidden>
- Date: Sat, 30 Mar 2002 19:15:46 -0700
On Sunday, 31 March 2002 email@hidden (Mr Tea) is rumored to have Spewed:
>
This from Matthew Stuckwisch - dated 30/3/02 05.56 pm:
>
>
> set monthNum to do shell script "date +%m"
>
>
As others have already observed, 'Woo hoo!'
>
>
I had to try some other options. Aside from the obvious two...
>
>
"date +%d" -->"31"
>
"date +%y" -->"02"
>
>
....I also got these potentially useful results with a quick trawl through
>
the lower case alphabet...
>
>
"date +%a" --> "Sun"
>
"date +%b" --> "Mar"
>
"date +%c" -->"03/31/02 00:50:08"
>
"date +%h" -->"Mar"
>
"date +%j" -->"090"
>
"date +%l" -->"12"
>
"date +%p" -->"AM"
>
"date +%r" -->"12:54:29 AM"
>
"date +%s" -->"1017536118"
>
"date +%w" -->"0"
>
"date +%x" -->"03/31/02"
>
>
Are there others? And what do the results for j (090), s (1017536118) and w
>
(0) signify?
man strftime
%A is replaced by the locale's full weekday name.
%a is replaced by the locale's abbreviated weekday name.
%B is replaced by the locale's full month name.
%b or %h
is replaced by the locale's abbreviated month name.
%C is replaced by the century (a year divided by 100 and truncated to
an integer) as a decimal number (00-99).
%c is replaced by the locale's appropriate date and time representa-
tion.
%D is replaced by the date in the format ``%m/%d/%y''.
%d is replaced by the day of the month as a decimal number (01-31).
%e is replaced by the day of month as a decimal number (1-31); single
digits are preceded by a blank.
%H is replaced by the hour (24-hour clock) as a decimal number
(00-23).
%I is replaced by the hour (12-hour clock) as a decimal number
(01-12).
%j is replaced by the day of the year as a decimal number (001-366).
%k is replaced by the hour (24-hour clock) as a decimal number (0-23);
single digits are preceded by a blank.
%l is replaced by the hour (12-hour clock) as a decimal number (1-12);
single digits are preceded by a blank.
%M is replaced by the minute as a decimal number (00-59).
%m is replaced by the month as a decimal number (01-12).
%n is replaced by a newline.
%p is replaced by the locale's equivalent of either ``AM'' or ``PM''.
%R is replaced by the time in the format ``%H:%M''.
%r is replaced by the locale's representation of 12-hour clock time
using AM/PM notation.
%T is replaced by the time in the format ``%H:%M:%S''.
%t is replaced by a tab.
%S is replaced by the second as a decimal number (00-60).
%s is replaced by the number of seconds since the Epoch, UCT (see
mktime(3)).
%U is replaced by the week number of the year (Sunday as the first day
of the week) as a decimal number (00-53).
%u is replaced by the weekday (Monday as the first day of the week) as
a decimal number (1-7).
%V is replaced by the week number of the year (Monday as the first day
of the week) as a decimal number (01-53). If the week containing
January 1 has four or more days in the new year, then it is week 1;
otherwise it is week 53 of the previous year, and the next week is
week 1.
%W is replaced by the week number of the year (Monday as the first day
of the week) as a decimal number (00-53).
%w is replaced by the weekday (Sunday as the first day of the week) as
a decimal number (0-6).
%X is replaced by the locale's appropriate time representation.
%x is replaced by the locale's appropriate date representation.
%Y is replaced by the year with century as a decimal number.
%y is replaced by the year without century as a decimal number
(00-99).
%Z is replaced by the time zone name.
%% is replaced by `%'.
_______________________________________________
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.