I have a date picker that I am trying to send a date to. I can figure it out when using current date. But if I want to send something that is not current date what format should I use? Example, if i want to send it a date of “01/04/2010” it does nothing.
set content of control "date_picker" of window "main" to current_date
set myDate to date "23/12/2012"
set content of control "Date Picker" of window "Main" to myDate
or just
set content of control "Date Picker" of window "Main" to (date "23/12/2012")
Hope it works,
ief2
EDIT: Just a reminder, if you compile your script, the string “23/12/2012” is going to change into something like this: date “zondag, 23 december 2012 00:00:00”. If you want to keep the original, define your date like this:
As of 10.6, building dates from strings has become even more unreliable, though. For example, your snippet now actually ignores my date format settings and uses the US settings.
It’s a bit more typing to do it the following way, but I reckon it’s worth the effort:
set thisDate to (current date) -- a starting date
set day of thisDate to 1 -- important
set year of thisDate to 2010
set month of thisDate to 1
set day of thisDate to 4