• 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: kai <email@hidden>
  • Date: Wed, 25 Apr 2007 21:11:17 +0100


On 25 Apr 2007, at 19:08, Nigel Garvey wrote:

kai wrote on Wed, 25 Apr 2007 16:53:15 +0100:

tell "20070105" as «class isot» as date to ¬
	{date:it, string:it as string, date string:date string, short date
string:short date string}

--> [listed vertically for greater legibility]:

	date: date "Friday, January 5, 2007 00:00:00"
	string: "Friday, January 5, 2007 00:00:00"
	date string: "Friday, January 5, 2007"
	short date string: "5/1/07"

I think there must be some confusion on your machine, Kai. Your script gives me the right results:

--> date:date "Friday 5 January 2007 00:00:00"
    string:"Friday 5 January 2007 00:00:00"
    date string:"Friday 5 January 2007"
    short date string:"05/01/2007"

(I've customised the commas out of the "British" date/time format on my
machines.)


Did you quit and relaunch Script Editor after each date-format reset for
your previous post?

I did, Nigel - although most applications seem pretty good at picking up changes on the fly (including AppleScript/Script Editor). I also tried a few logout/login cycles - as well as a shutdown/reboot.


As mentioned earlier, the date in the menu bar behaves as expected - as do dates in Finder, iCal and various other applications. The date formats all change pretty much instantly, too.

When running a test script, either in Script Editor or as an applet (even after quitting SE), all date formats behave as expected - apart from the default for the United Kingdom. (I'm currently running AppleScript version 1.10.6 on this machine, rather than 1.10.7, although I don't *think* that should be an issue.)

Further testing reveals that, if I adopt a custom format, it works fine here, too. For example, if I carry out your sans-comma customisation, I get similar results to those returned on your machine:

   -->	date:date "Friday 5 January 2007 00:00:00"
	string:"Friday 5 January 2007 00:00:00"
	date string:"Friday 5 January 2007"
	short date string:"05/01/2007"

If I then replace the comma manually, so that the formatting is identical to the UK default (but it's still a custom format), that also behaves very nicely:

   -->	date:date "Friday, 5 January 2007 00:00:00"
	string:"Friday, 5 January 2007 00:00:00"
	date string:"Friday, 5 January 2007"
	short date string:"05/01/2007"

However, whenever I re-select the United Kingdom default setting, what do I get? ...

   -->	date:date "Friday, January 5, 2007 00:00:00"
	string:"Friday, January 5, 2007 00:00:00"
	date string:"Friday, January 5, 2007"
	short date string:"5/1/07"

Thanks for jumping in. I appreciate your help in providing a sanity check on this. What would really interest me now is what you get if you re-select the default UK setting...

:-)

---
kai


_______________________________________________ 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:
    • perl regex works differently within a "do shell script" than from within perl
      • From: John McKenzie <email@hidden>
    • Re: Simple Date-Time Format Question...
      • From: kai <email@hidden>
References: 
 >Re: Simple Date-Time Format Question... (From: "Nigel Garvey" <email@hidden>)

  • Prev by Date: Re: Simple Date-Time Format Question...
  • Next by Date: How to convert my text to PC encoding when using "write"
  • Previous by thread: Re: Simple Date-Time Format Question...
  • Next by thread: Re: Simple Date-Time Format Question...
  • Index(es):
    • Date
    • Thread