coerce date/time information to date

Hi,

I want to be able to coerce two strings (e.g. “12:37:32” and “2005-11-14”) to an AS date variable so I can do date calculations. Once the calculations are done I then want to convert back to the original format. My question is about the initial coersion.

Using “2005-11-14” fails to convert but changing the format enables it


set dStr to "11-14-05"
return date dStr

date "Monday, November 14, 2005 12:00:00 AM"

If need be I can convert “2005-11-14” to the format “11-14-05” but how do I include the time in dStr to get the time set at the same time as the date? (simply concatinating the two strings separated by a space didn’t work). Maybe I should convert the time to seconds and simply add it to the result?

Brad

Hi, Brad.

Concatenation does work here. Did you remember to use parentheses?

return date (dStr & " " & "12:37:32")

Problem solved using brackets.

Thanks,
Brad