Convert date format

  • Thread starter Thread starter Mat
  • Start date Start date
M

Mat

Hi
I read from a log file and import this into a field in a
table. The actual import works fine, but because the log
file is created using a US-based program the date format
is MMDDYY. My access database is set to read in UK
standard - so the resultant field is recorded wrong. Any
ideas how I can convert this to DDMMYY format ?
Thanks
Mat
 
Mat said:
I read from a log file and import this into a field in a
table. The actual import works fine, but because the log
file is created using a US-based program the date format
is MMDDYY. My access database is set to read in UK
standard - so the resultant field is recorded wrong. Any
ideas how I can convert this to DDMMYY format ?


Assuming the date is in a text field and it soesn't have an
other characters in it:

CDate("#" & Left(field) & "/" & Mid(field,2,2) & "/" &
Right(field,2) & "#")
 
Hi
I read from a log file and import this into a field in a
table. The actual import works fine, but because the log
file is created using a US-based program the date format
is MMDDYY. My access database is set to read in UK
standard - so the resultant field is recorded wrong. Any
ideas how I can convert this to DDMMYY format ?
Thanks
Mat

Is this a Text field, or a Date/Time field? If it's a date field, it's
actually stored without any formatting, as a double float count of
days since a start point (12/30/1899 at midnight); you can simply set
the field's format to ddmmyy to display in that way.

If it's a Text field then Access has no way of knowing that it's
actually a date. You'll need to run an Update query to flip it around.

John W. Vinson[MVP]
 
The actual import works fine, but because the log
file is created using a US-based program the date format
is MMDDYY. My access database is set to read in UK
standard

Just don't even think about using VB defaults to decode dates: _always_ do
them explicitly...


dtNewDate = DateSerial(2000 + CInt(Mid$(strOldDate,5,2)), _
CInt(Mid$(strOldDate, 1,2)), _
CInt(Mid$(strOldDate, 3,2)))


By the way, put that 2000 in there with your fingers crossed. Just how
stupid are your log-writing-programmers?

All the best


Tim F
 
By the way, put that 2000 in there with your fingers crossed. Just how
stupid are your log-writing-programmers?

Maybe they're highly intelligent but only four years old!
 
Back
Top