• 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: parsing Unix date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parsing Unix date


  • Subject: Re: parsing Unix date
  • From: Graff <email@hidden>
  • Date: Sat, 10 Jan 2004 18:06:44 -0500

On Jan 10, 2004, at 1:40 PM, Emmanuel wrote:

At 12:05 PM -0600 10/01/04, Christopher Stone wrote:
At 02:16 -0500 01/10/2004, Graff wrought:

The time reported by the date tool is 02:06:34, the time reported by AppleScript's date coercion is 10:02:06. This is because AppleScript's date coercion is mistakenly taking the 10 which leads the string "02:06:34" as the hour
______________________________________________________________________

This is particularly surprising considering how prevalent the Unix date string format is in computing and considering that Mac OS X now sits on top of Unix...

Perhaps Mr. Nebel will file it as a bug?

It's not clear for me how you can expect such a thing to work easily. There is only one UNIX date default format, while there are as many AppleScript date formats as localizations, or am I missing something?

Honestly probably the easiest and most compatible way would be to special case the UNIX default date tool format. If the date string is formated as so (with spaces between each field instead of returns):
3 char weekday name
3 char month name
1 or 2 char day as an integer
hh:mm:ss
3 char time zone name
4 int year

Then interpret it appropriately, otherwise pass it to the regular parser.

The best way would be to fix the parser so that this format parses correctly but that might be tough to do properly. Since this date format is probably the most common format out there (due to it being the standard format for the date tool) it might be worth it to try as a direct match first, both for speed and for accuracy.

- Ken
_______________________________________________
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.

References: 
 >Re: parsing Unix date (From: Paul Berkowitz <email@hidden>)
 >Re: parsing Unix date (From: Graff <email@hidden>)
 >Re: parsing Unix date (From: Christopher Stone <email@hidden>)
 >Re: parsing Unix date (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Scripting QuarkXPress 5 in Classic mode
  • Next by Date: Re: Obtaining default Email application name
  • Previous by thread: Re: parsing Unix date
  • Next by thread: Re: parsing Unix date
  • Index(es):
    • Date
    • Thread