UNLESS you formatted it with the Format() function. Format() converts a date to a string and that makes it act like a string rather than like a date. A date string will NOT sort or compare the way you would expect it to. Strings sort/compare character by character, left to right.NOT as text.
The question is how they are stored; specifically, the data types of each field. Depending on how they were stored, your answer will differ.
It is, of course, your choice, but to store date and time as two separate fields for the same event very slightly wastes space. Of course, for convenience sake, you do what you feel you must - but if they were all combined in a date field, you could compare the two event date/time combinations in a simple IF [Date1]>[Date2] kind of statement.
If ( [Date1] + [Time1] ) > ( [Date2] + [Time2] ) Then ...
{was greater}
Else
{was less or equal}
End if
If I wanted to make a custom date & time field that had a short date + short time, would I format it as mm/dd/yyyy;hh:mm?OK, the simplest answer with what you have is
Code:If ( [Date1] + [Time1] ) > ( [Date2] + [Time2] ) Then ... {was greater} Else {was less or equal} End if
I believe the format is:mm/dd/yyyy;hh:mm
I believe the format is:
mm/dd/yyyy hh:nn
"nn" for seconds. "mm" for month. However, I would remove the format property entirely. That should also work and is less likely to get you into trouble.
If I wanted to make a custom date & time field that had a short date + short time, would I format it as mm/dd/yyyy;hh:mm?
The answer depends on how you want to store the data.
Are you storing in a string or are you storing in a Date/Time?
If you do that in a string it will save in exactly that format. If you store in Date/Time then the format is not relevant.
If you DO decide to save it in a string I would recommend YYYYMMDDhhnn format (remember, minutes are n not m) so that you can sort by that format.
If you are saving in a Date/Time then the format is for display / entry only and has no bearing on how the data is actually stored.
I'm storing in Date/Time. I'd just like users to type the data as MM/DD/YYYY hh:nn.
Access saves dates & times as integers
It is worse than that. Let's just take two dates:That other stuff with MM/DD/YYYY hh:nn is just a display date or an input mask used for convert dates to or from strings. Internally, you do better with dates. They are faster and easier to compare and take up less space, since a date is 8 bytes as a DOUBLE but MM/DD/YYYY HH:NN is 16 bytes as text.