//CF Fundamentals (Date and Time)

CF Fundamentals (Date and Time)

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.

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

About the Author:

Public servant, coder, amateur photographer, husband, father, grill master, cook, traveler, dreamer, and optimist. The order changes depending on the situation.

Leave a Reply