Date Conversion

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

Guest

I have a column in a table that I imported from a text file that contains a
date in the format YYYYMMDD. How can I convert this date to MM/DD/YYYY
format?
 
Add a new field to the table. Then run an update query to put the date into
that new field, using an expression to convert the text string to the date.
For example:

UPDATE Tablename
SET NewDateField =
DateSerial(Left([ImportedDate], 4), Mid([ImportedDate], 5, 2),
Right([ImportedDate], 2));
 
Another option is

UPDATE Tablename
SET NewDateField = CDate(Format([ImportedDate], "####\/##\/##")


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Ken Snell said:
Add a new field to the table. Then run an update query to put the date into
that new field, using an expression to convert the text string to the date.
For example:

UPDATE Tablename
SET NewDateField =
DateSerial(Left([ImportedDate], 4), Mid([ImportedDate], 5, 2),
Right([ImportedDate], 2));

--

Ken Snell
<MS ACCESS MVP>



DaveK said:
I have a column in a table that I imported from a text file that
contains
a
date in the format YYYYMMDD. How can I convert this date to MM/DD/YYYY
format?
 
Hi,
I have a similar situation.
I have a date 12/08/2004 which needs to be appended to another table as a
text file as 20041208 , YYYYMMDD format.
Thanks in advance.
Douglas J. Steele said:
Another option is

UPDATE Tablename
SET NewDateField = CDate(Format([ImportedDate], "####\/##\/##")


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Ken Snell said:
Add a new field to the table. Then run an update query to put the date into
that new field, using an expression to convert the text string to the date.
For example:

UPDATE Tablename
SET NewDateField =
DateSerial(Left([ImportedDate], 4), Mid([ImportedDate], 5, 2),
Right([ImportedDate], 2));

--

Ken Snell
<MS ACCESS MVP>



DaveK said:
I have a column in a table that I imported from a text file that
contains
a
date in the format YYYYMMDD. How can I convert this date to MM/DD/YYYY
format?
 
Use the Format function to convert the date to your desired format:

Format([DateFieldName], "yyyymmdd")


--

Ken Snell
<MS ACCESS MVP>

Kris said:
Hi,
I have a similar situation.
I have a date 12/08/2004 which needs to be appended to another table as a
text file as 20041208 , YYYYMMDD format.
Thanks in advance.
Douglas J. Steele said:
Another option is

UPDATE Tablename
SET NewDateField = CDate(Format([ImportedDate], "####\/##\/##")


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Ken Snell said:
Add a new field to the table. Then run an update query to put the date into
that new field, using an expression to convert the text string to the date.
For example:

UPDATE Tablename
SET NewDateField =
DateSerial(Left([ImportedDate], 4), Mid([ImportedDate], 5, 2),
Right([ImportedDate], 2));

--

Ken Snell
<MS ACCESS MVP>



I have a column in a table that I imported from a text file that contains
a
date in the format YYYYMMDD. How can I convert this date to MM/DD/YYYY
format?
 
I found the answer in a previous post.
I helps to read!
Thanks for the info!

Kris said:
Hi,
I have a similar situation.
I have a date 12/08/2004 which needs to be appended to another table as a
text file as 20041208 , YYYYMMDD format.
Thanks in advance.
Douglas J. Steele said:
Another option is

UPDATE Tablename
SET NewDateField = CDate(Format([ImportedDate], "####\/##\/##")


--
Doug Steele, Microsoft Access MVP

(No private e-mails, please)


Ken Snell said:
Add a new field to the table. Then run an update query to put the date into
that new field, using an expression to convert the text string to the date.
For example:

UPDATE Tablename
SET NewDateField =
DateSerial(Left([ImportedDate], 4), Mid([ImportedDate], 5, 2),
Right([ImportedDate], 2));

--

Ken Snell
<MS ACCESS MVP>



I have a column in a table that I imported from a text file that contains
a
date in the format YYYYMMDD. How can I convert this date to MM/DD/YYYY
format?
 
Back
Top