|
|
Q3014 How do I display the current date and/or time? Can I format it different ways?
irt.org | Knowledge Base | ColdFusion | Q3014 [ previous next ] Q3014 How do I display the current date and/or time? Can I format it different ways?Use the Now() function to obtain the current date and time from the server.
returns the date in the following format: {ts '1999-06-24 10:29:54'} By using the DateFormat() function, we can tell ColdFusion that we want to see a date:
returns 24-Jun-99 Continuing onward, we can customize the date format even more by specifying a mask in the DateFormat() function.
returns 06/24/99
returns Thu, Jun 24, 1999
returns Thursday, June 24, 1999 The TimeFormat() function is similar to DateFormat(), except, of course, that it returns the time.
returns 10:39 PM
returns 10:40:23 PM
returns 22:40:23. (Note: The capital letters "HH" tells CF to display using a 24-hour clock.)
This returns: |
-- div -->
|