DFORMAT returns a formatted date.
SYNTAX:
DFORMAT(Date,Format)
Date: A string representing a valid date, i.e. "1/2/2004", a cell reference to a cell containing a date string, or a function that returns a date string (such as DSORT). Function will also allow times in the following formats - hhmm,hmm,hh.mm,h.mm (see examples below).
Format: Date Format (i.e. "mm/dd/yyyy"...) to return.
NOTES:
Returns a Text string. Cell type will be changed to Text when using this formula.
EXAMPLES:
DFORMAT("5/1/07","ddd") returns Tue
DFORMAT(B3,"yyyy") returns 2008 where cell B3 contains "1/15/2008"
DFORMAT("1245","hh:mm AMPM") - Returns 12:45 PM, assumes miltary time is the input.
DFORMAT(44000,"m/d/yyyy") - Returns 6/18/2020. The number 44000 represents the number of days since 12/30/1899. Note you can take the VAL of a date to return this number (IE VAL("6/18/2020") returns 44000.
DFORMAT(44000.5,"m/d/yyyy hh:mm") - Returns 6/18/2020 12:00. The decimal portion represents the part of the day, i.e. .5 is half the day (noon).