I still haven't seen an answer elsewhere, so...I figured out how to use VBScript to parse the date field in the layer's display expression, so that what shows up when you identify features will be a string representing the date that is actually chronological when sorted.
In the display expression, check advanced, and use something like this:
Function FindLabel ([UPDATEDATE])
yr = DatePart("yyyy",[UPDATEDATE])
mon = DatePart("m",[UPDATEDATE])
if Len(mon)<2 then
mon = "0" & mon
end if
dy = DatePart("d",[UPDATEDATE])
if Len(dy)<2 then
dy = "0" & dy
end if
hr = DatePart("h",[UPDATEDATE])
if Len(hr)<2 then
hr = "0" & hr
end if
min = DatePart("n",[UPDATEDATE])
if Len(min)<2 then
min = "0" & min
end if
sec = DatePart("s",[UPDATEDATE])
if Len(sec)<2 then
sec = "0" & sec
end if
FindLabel = yr & "-" & mon & "-" & dy & " " & hr & ":" & min & ":" & sec
End Function
This uses DatePart()
to parse out the year, month, day, hour, minute, and second elements (in my case, from a field called UPDATEDATE), defines them as separate variables yr
mon
dy
hr
min
and sec
, and then constructs a string to constitute the display expression with hyphens and colons in between. To make each element sort correctly, the code uses Len()
to get the length of each element, and if the length is <2, it concatenates "0" in front of the value, so 12 won't be sorted before 3, for example.
Maybe there's a simpler way, but this accomplished what I wanted.