Date Fromat in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to change the date format in vb code from mm/dd/yy to dd/mm/yy as this
value is loctaed in a table and with dates like 11/12/04 i don't want the
code to use 12/11/04.
 
I need to change the date format in vb code from mm/dd/yy to dd/mm/yy as this
value is loctaed in a table and with dates like 11/12/04 i don't want the
code to use 12/11/04.

Neither text string is stored in the table, if the table has date/time
fields. A Date/Time is stored as a Double Float number, a count of
days and fractions of a day since midnight, December 30, 1899. If you
need the dd/mm/yy format for display purposes, you can use an
expression like

Format([datefield], "dd/mm/yy")

to create a String value in the format you desire.

Note that date literals in VBA code MUST be either in American
mm/dd/yyyy format, or an unambiguous format such as yyyy-mmm-dd.
dd/mm/yy formatted dates WILL BE INTERPRETED INCORRECTLY if you use
them for searching or matching. Perhaps you could describe what you're
trying to do, and post a snippet of the relevant code.

John W. Vinson[MVP]
Join the online Access Chats
Tuesday 11am EDT - Thursday 3:30pm EDT
http://community.compuserve.com/msdevapps
 
Back
Top