How can I convert my date to “mm/dd/yyyy” format :?:
I know this is not exactly what you want, but might lead you to a suitable solution:
put the day into currentDay put the month into currentMonth put the year into currentYear Log "Today is: " & currentMonth & "/" & currentDay & "/" & currentYear
The result is:
“Log Today is: 6/2/2015”
Dates and times come in an astonishing number of different formats. SenseTalk has dozens of date and time formats built in, but the one you want doesn’t happen to be one of them.
Fortunately, there are a couple of ways you can get almost any format you want. The formattedTime() function is simple and works like this:
put formattedTime("%m/%d/%Y", myDate) into myNewDate
When a variable contains a date/time value it has a format property that you can set to change the format of the value in the variable:
put today plus 1 week into dateNextWeek put dateNextWeek -- shows "2015-06-09" put the format of dateNextWeek -- shows "%Y-%m-%d" set the format of dateNextWeek to "%m/%d/%Y" put dateNextWeek -- shows "06/09/2015"
Use whichever approach works well for you.
I tried exactly how you said but its returning as “mm/dd/yy” not “mm/dd/yyyy”
Try it with a cap Y:
put today plus 1 week into dateNextWeek set the format of dateNextWeek to "%m/%d/%Y" put dateNextWeek
It worked, thanks