• 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: How to use date of current date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use date of current date


  • Subject: Re: How to use date of current date
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 31 Oct 2012 10:02:36 +0000

"emile.a.schwarz" wrote on Wed, 31 Oct 2012 09:59:18 +0100:

>in the documentation I saw an entry 'date' in the date (class, command,
>feature, whatever it it called / classified).
>
>But I am unable to use it.
>
>All I wanted was to see what it returns (certainly the date part of a
>date like time is the time part of a date).

Hi.

If you're talking about 'current date', the '-> date' is the class of
the AppleScript object it returns. It doesn't have a 'date' property.

>PS: I need to get SQLDate (YYYY-MM-DD) and I feel that I will have to do
>it by myself…)

To get the current date in that format, you could use this one-liner:

  tell (current date) to tell ((its year) * 10000 + (its month) * 100 + (its day)) as text to set SQLDate to text 1 thru 4 & "-" & text 5 thru 6 & "-" & text 7 thru 8

There is in fact a shorter hack, but it may not work for much longer:

  text 1 thru 10 of ((current date) as «class isot» as string) -- Must be 'string'.

NG

 _______________________________________________
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


  • Prev by Date: Re: How to use date of current date
  • Next by Date: Re: How to use date of current date
  • Previous by thread: Re: How to use date of current date
  • Index(es):
    • Date
    • Thread