Convert yymmdd text to useable date format

crosser

New Member
Joined
Aug 17, 2011
Messages
9
I have a linked database table with this field.
I will need to calculate the difference between this date and another which happens to be in this format mm/dd/yyyy

How do I do this? I will need convert it through an access formula since it's a linked table that cannot change and is updated daily.

The help on this forum is fantastic, thanks for helping a newb
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
You need a query and perhaps you can look at the Date Diff Function or possible look to format the field in an Expression.

Look at this SQL view of a query which has only selected a single field which has dates in the yy/mm/dd format and changes it in an expression to dd/mm/yy

SELECT Table1.DateSomething, Format([DateSomething],"dd/mm/yy") AS SwapFormat
FROM Table1;
 
Upvote 0
Thanks for the quick reply Trevor but I don't think that will work. Its a text data field such as 100101 which is yymmdd.

I have NO idea why this field was setup in this manner in the first place.

Ultimately I will need to calculate the difference between this field and another which is a date type mm/dd/yyyy. Once I learn how to get the conversion then I was going to do the date diff function.
 
Upvote 0
To get the difference, all you need to do is subtract one from the other, if they are both formatted as Dates and not Text. You can convert a Text format to a Date format using the DateSerial function (format: DateSerial(year,month,day)).

For your exmaple in "yymmdd" format, that would look something like this:
Code:
MyCalcDate: DateSerial(Left([MyTextDate],2),Mid([MyTextDate],3,2),Right([MyTextDate],2))
So if you had a "real date" and wanted to subtract your "text" date, you
Code:
could have a formula that would look something like this:
MyDateDiff: [MyDate]-DateSerial(Left([MyTextDate],2),Mid([MyTextDate],3,2),Right([MyTextDate],2))
 
Upvote 0
Joe4 - Perfect! Thank you so much! Was able to plug that in and worked as expected. Have a good one
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top