Re: Date Help - D&T stamp w Short dates
Re: Date Help - D&T stamp w Short dates
- Subject: Re: Date Help - D&T stamp w Short dates
- From: John W Baxter <email@hidden>
- Date: Sat, 11 Jan 2003 21:14:20 -0800
- Envelope-to: email@hidden
At 4:34 -0800 1/11/2003, Patrick D. Fox wrote:
>
> Basically, I would like to create a date - time stamp that ideally would
>
> look like the following
>
>
>
> IDEAL1: 01-06-03 09-23-21 AM (mm-dd-yy)
>
> IDEAL2: 2003-01-06 09-23-21 AM (yyyy-mm-dd)
>
>
Try:
>
>
set ideal1 to do shell script "date +''%m-%d-%y' '%I-%M-%S' %p'"
>
set ideal2 to do shell script "date +''%Y-%m-%d' '%I-%M-%S' %p'"
Those would be my choice from what I've seen. Added commentary:
If you're ever going to want to sort strings (eg file names) containing
these time stamps, forget #1 and use #2, modified to 2a, which uses 24 hour
time, not the foolish American 12 hour clock. The strings from #2a sort
naturally into temporal order...it's "somewhat harder" to do with #1. (The
easy way is to convert #1 to #2a, sort, and convert back.)
2a: 2003-01-06 21-23-21 (moving your example forward 12 hours so the 24
hour time is obvious...keep the leading zero on hours 0 through 9)
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
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.