• 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: Simple Date-Time Format Question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Date-Time Format Question...


  • Subject: Re: Simple Date-Time Format Question...
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 25 Apr 2007 11:59:15 -0400

On 4/25/07, revDAVE <email@hidden> wrote:
This is good fun - I have never really used shell scripts before - is there
a URL I can read some information about them?

The best documentation for things like the format string to date is the man page. Just type "man date" in a Terminal window. The full list of format controls is there.

I tried to  to get the year first but also wanted only 2 digit year - not a
4 digit year for my particular use... Like: "07-04-25 12-11-10 PM"

That will cause sorting issues if you ever have to deal with dates from back before 2000, but it's easy to get - %y (note lowercase) is the two-digit year.

Q: does %F - stand for full date?
In ISO-8601 format, yes.  %F is exactly equivalent to %Y-%m-%d.

do shell script "date +'%F %H-%M-%S'"

Note that the official ISO time format uses colons instead of hyphens, and can be obtained with the simple %T. The full ISO date/time stamp is "date + '%FT%T'".

--
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:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Simple Date-Time Format Question...
      • From: kai <email@hidden>
References: 
 >Re: Simple Date-Time Format Question... (From: Philip Aker <email@hidden>)
 >Re: Simple Date-Time Format Question... (From: revDAVE <email@hidden>)

  • Prev by Date: Re: Simple Date-Time Format Question...
  • Next by Date: Re: Simple Date-Time Format Question...
  • Previous by thread: Re: Simple Date-Time Format Question...
  • Next by thread: Re: Simple Date-Time Format Question...
  • Index(es):
    • Date
    • Thread