Re: Getting time components of date
Re: Getting time components of date
- Subject: Re: Getting time components of date
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 22 Dec 2003 14:01:08 -0500
To: Applescript Users <email@hidden>
From: Chris Garaffa <email@hidden>
Subject: Getting time components of date
Date: Mon, 22 Dec 2003 07:59:54 -0500
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!
You could try something like this:
set startDtStrng to "01/01"
set startDt to date startDtStrng
set x to (current date) - startDt -- get date as seconds since
beginning of year
set HH to (x mod days / hours) div 1
set MM to (x mod hours / minutes) div 1
set SS to x mod minutes
{HH, MM, SS}
Or you could use a "do shell script" and the Unix "date" utility.
Marc [12/22/03 1:59:57 PM]
_______________________________________________
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.