Table of Contents
Returns a specifically formatted date string from a passed applescript date. If you pass no date to the default parameter then the current date is used. At least one date, time or format string parameter is required or the verb will return an empty string. The Long, Short and Abbreviated times or dates are returned according to the system date/time configuration and your localization settings.
- DateType [Long|Short|Abbreviated] (Long: Saturday, Feb 3 2004, Short: 2/3/2004, Abbreviated: Mon, Feb 3 2004)
- TimeType [Long|Short] (Long: 2:33:04pm, Short: 9:30am)
- FormatString a string that can contain any of the following tags which will be replaced with the appropriate data. Any non-tag characters will be included in the output unchanged. NOTE in these cases the brackets do not denote an optional parameter but should actually be included in the string passed to FormatString.
- [sortable] (returns a date formatted as: YYYY MM DD HHMMSS ie: “2016 03 30 121433” which can be lexicographically sorted.)
- [day] (the day of the month as a number)
- [dayOfWeek] (a numerical day of the week (not the weekday name) starts on Sunday or Monday as per your system date/time settings.
- [dayOfYear] (the day of the year as a number)
- [hour] (the hour as a number)
- [minute] (the minute as a number)
- [second] (the second as a number)
- [month] (the month of year as a number (not the month name)
- [weekOfYear] (the week of the year)
- [year] (the year as a 4 digit number)
write log “long date format: “ & xtFormatDate (last timestamp “a unit”) dateType Long timeType long
write log “the current year is: “ & xtFormatDate formatString “[year]”
write log xtFormatDate formatString “The time is [minute] minutes past the hour of [hour]”
write log xtFormatDate formatString “you have lived through [dayOfYear] days of [year] so far!”
dictionary/more/formatdate.txt · Last modified: 2023/02/13 14:52 by 127.0.0.1