Top | Previous | Next |
Date and Time / dateFormat |
dateFormat(date, pattern) Returns the given date as a string, formatted according to a pattern. The pattern is a format that is full of various placeholders that will display different parts of the date. These are case-sensitive! The most common placeholders are:
These placeholders can be repeated for a different effect. For example, M will give you 1-12, MM will give you 01-12, MMM will give you Jan-Dec, MMMM will give you January-December.
dateFormat(toDate("2003-9-14 8:00:00"), "yyyy-MM-dd h a") ...returns the string "2003-09-14 8 AM"
dateFormat(toDate("2003-9-14 8:00:00"), "MMM d, yyyy") ...returns the string "Sep 14, 2003" |