CF Fundamentals (Date and Time)

By |2018-06-24T11:46:39+00:00March 30th, 2014|Code|0 Comments

Relaunch of an old post.

So this week (January 24, 2012), I had the need for dates of varying formats and I decided to post a beginners post. I currently am using CF Builder at work and as much as I like Dreamweaver, CF Builder showed me something I had never used before or haven’t used in so long that I have forgotten; the built-in date formats (long, medium, short, and full). I have always used a custom format and so I thought I would share. I have added several variations.

Here is the code:

Copy to Clipboard

Built-In Date Formats

Copy to Clipboard

Built-In Time Formats

Copy to Clipboard

Custom Formats

Copy to Clipboard

Note: Remember, these are based on the server’s date and time. Even though I am on the East Coast, my shared hosting server is in a different time zone.  Also, look at LSDateFormat for localization possibilities.

More info on additional date functions is available at  http://cfdocs.org/date-and-time-functions

Update: Since this article was originally posted, Adobe (ColdFusion 2018) and Lucee have added new time parts.

Leave a Reply