On 2016-03-27 07:52:43 +0000, JF Mezei said:
I've found the following on the web (not tested)
set theDate to (current date)
set theHour to fillInZero(hours of (theDate) as integer)
set theMinutes to fillInZero(minutes of (theDate) as integer)
tell theDate to get (it's month as integer)
set theMonth to fillInZero(result)
set theDay to fillInZero(day of theDate)
So, how would I know that I can specify
"minutes of (theDate) as integer"
when this was not listed in the apple web page I specified in previous
post, so where would it be documented ?
In the Applescript Language Guide <http://apple.co/1E6eql1>
And why can I specify as a variable (argument to routine or value to be
assigned to variable)
minutes of (theDate) as integer
but I can't do that with month of (theDate( as integer ?
You can
set theDate to (current date)
month of theDate as integer -- returns 3 for March
What exactly happens when I "tell theDate to get (it's month as integer) ?
Does the date class have methods to convert stuff, and if so, where are
those documented ?
In the Applescript Language Guide <http://apple.co/1E6eql1> such as they are.
When I use the simple "hours of (theDate( as integer", does this
involve any methods or just basic applescript language processing while
the conversion of the month involves a method avaualble for a date object?
For myself I've found it much easier to use 'strftime' to retrieve 'dates' in a specific format i.e.
do shell script "date '+%m/%d/%Y'" will return "03/27/2016", see: unix man pages for "date" and "strftime"
the Satimage.osax contains a command that can duplicate the shell's function. It is "strftime" and uses the same formatting as the shell, see: unix man page "strftime".
strftime (current date) into "%m/%d/%Y" -- returns 03/27/2016