Function Dates Times Class

DateTimeSortedString

"Date And Time To Sorted String" Convert a date/time value into a numeric string which can be used to sort the date into chronological order. Components of the date and time are ordered from the most significant (the year) to the least significant (the second).

Signature (Visual Basic / VBA)

Public Function DateTimeSortedString( _
    ByVal vDateTime As Variant _
    ) As Variant

Code Examples

    DateTimeSortedString(#02/03/1987 04:05:06#) = "19870203040506"
    DateTimeSortedString(#12/31/2101 12:59:48#) = "21011231125948"
    DateTimeSortedString(#11:59:48#) = "18991230115948"
    DateTimeSortedString(#12/31/1845#) = "18451231000000"
    1) the four-digit year (0100..9999)
    2) the month (00..12)
    3) the day (01..31)
    4) the hour (00..23)
    5) the minutes (00..59)
    6) the seconds (00..59)

Parameters

Parameter Description
vDateTime The date/time value which is returned as a numeric string. Function returns Null if vDateTime is Null or cannot be fixed up to a Date.

Return Value

The return value is composed of: