• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Date-Time Formatting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Re: Date-Time Formatting (From: Gnarlodious <email@hidden>)

  • Prev by Date: Mail: Finding messages by ID
  • Next by Date: Re: Date-Time Formatting
  • Previous by thread: Re: Date-Time Formatting
  • Next by thread: Re: Date-Time Formatting
  • Index(es):
    • Date
    • Thread