• 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: Getting time components of date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting time components of date


  • Subject: Re: Getting time components of date
  • From: Graff <email@hidden>
  • Date: Mon, 22 Dec 2003 13:23:45 -0500

You can either use the method you have mentioned on your web page or you can directly get the string you want from the command line environment:
do shell script "date '+%Y-%m-%d %T'"

And I agree, it should be easier to do this directly in AppleScript. An hour, minute, and second property should be added to the Date class. The hour should default to a 24 hour format when you get it as a property, with another property to determine if the default format for the current user is 24 hour or AM/PM.

- Ken

On Dec 22, 2003, at 7:59 AM, Chris Garaffa wrote:

Hi all,

While working to convert an AppleScript date to a MySQL DATETIME date (yyyy-mm-dd hh:mm:ss) I ran into a small problem. While AppleScript supports things like:
month of someDate
day of someDate
year of someDate
etc
It doesn't provide for
hour of someDate
minute of someDate
seconds of someDate

but instead gives us "time string". Using this and some TID manipulation, I was able to get the information I wanted [1] but I think it should be easier. I've filed a feature request with Apple and hope that anyone else who agrees will do the same.

Thanks!

[1] See <http://moondrop.nilzero.com/archives/2003/12/22/ applescript_date_to_mysql_datetime.php> for how I did it - There's probably a better way, but this works for me.
_______________________________________________
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: 
 >Getting time components of date (From: Chris Garaffa <email@hidden>)

  • Prev by Date: Re: OT: "Reply to all" oddity; server or Entourage??
  • Next by Date: Finder's dictionary
  • Previous by thread: Re: Getting time components of date
  • Next by thread: Re: Getting time components of date
  • Index(es):
    • Date
    • Thread