Using Date/Time Fields

  • Thread starter Thread starter Ryan Langton
  • Start date Start date
R

Ryan Langton

Does anyone have any tutorials that explain ways to use the date/time field?
I use these fields often to document when users perform actions using the
Now() function. I'd like to be able to query these fields for things like
just a particular date or between certain times of the day. Currently, for
example, to extract only the date from a date/time field, I use the
Convert() function to extract only the first 10 characters. Surely there is
a better way to do this:
Convert(Char(10), DateOpen, 101)

Thanks,
Ryan
 
No, there is no better way, excerpt maybe using Nchar(10) instead of
Char(10) when accessing from Access2000+, because since the 2000 version,
Access is now working in Unicode mode.
 
Ok. I thought maybe their would be functions to extract just certain
information from a date/time field. Thanks for the info.

Ryan
 
They are functions for extracting some parts of a DateTime field: Year(),
Month() and Day() for exemple; however there is not Date or Time base types
in SQL, so there is no function to extract only the date part or the time
part of a DateTime field and using 3 functions calls (Year() + Month()
+Day()) in replacement of a single call to Convert() will be even uglier.
 
Back
Top