David J Murray Dev
~ Learn and Do - Excel and Share ~

Format a date

Jun 1, 2006
You're Reading: Format a date

Many times in the dim dark past, I have seen and, I must admit, done the following to format a date into YYYYMMDD format:


Or something similar.

But it is possible to do the following:

DISPLAY.DTE = OCONV(@DATE, "D4YMD[4'', 2'', 2]")

How does it work?

Well, the D4YMD means to format the year as 4 digits, place Year first, followed by Month then Day.

The [4”, 2”, 2] formats the YMD (in that order) to 4 digits long for the year, followed by a empty string (” – two single quotes), followed by 2 digits for the month, a empty string, and then last 2 digits for the day.

If the empty strings are not supplied, the default is to separate the fields by a space.

See help at ECL


or your local manual hoarder.

About the Author

<a href="https://davidjmurray.dev/losucag/davidjmurray/" target="_self">djm</a>


I have been in the computer/IT industry for over 35 years. After spending half a life-time in highly proprietary database environments, I have succumbed to the WordPress Eco-system and I'm well down the chasm. I am specializing in AWS hosting, Wordpress CMS, Elegant Themes, in particular Divi and Extra themes.


Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This