ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to convert string to a date (https://www.excelbanter.com/excel-worksheet-functions/16125-how-convert-string-date.html)

galsaba

How to convert string to a date
 
I need to do few conversion.
the date in a date field is a string data of this format:
1010230 which indicates 02/30/2001 (101 is 2001)
1051215 indicates 12/15/2005.
How can I convert one to the other?

Also I have
1010230 that I want to convert to a string of YYYYMMDD

and string YYYYMMDD that I want to convert to date format MM/DD/YY

Thanks,

galsaba


Jason Morin

For the first 2 dates, use:

=--(MID(A1,4,2)&"-"&RIGHT(A1,2)&"-"&MID(A1,2,2))

By the way, 2/30/2001 is not a real date and the formula
will produce an error.

HTH
Jason
Atlanta, GA

-----Original Message-----
I need to do few conversion.
the date in a date field is a string data of this format:
1010230 which indicates 02/30/2001 (101 is 2001)
1051215 indicates 12/15/2005.
How can I convert one to the other?

Also I have
1010230 that I want to convert to a string of YYYYMMDD

and string YYYYMMDD that I want to convert to date

format MM/DD/YY

Thanks,

galsaba

.


galsaba

Then how should i convert it to a real date?

Galsaba

Jason Morin wrote:
For the first 2 dates, use:

=--(MID(A1,4,2)&"-"&RIGHT(A1,2)&"-"&MID(A1,2,2))

By the way, 2/30/2001 is not a real date and the formula
will produce an error.

HTH
Jason
Atlanta, GA

-----Original Message-----
I need to do few conversion.
the date in a date field is a string data of this format:
1010230 which indicates 02/30/2001 (101 is 2001)
1051215 indicates 12/15/2005.
How can I convert one to the other?

Also I have
1010230 that I want to convert to a string of YYYYMMDD

and string YYYYMMDD that I want to convert to date

format MM/DD/YY

Thanks,

galsaba

.



Peo Sjoblom

What Jason meant is that there is no February the 30th

--

Regards,

Peo Sjoblom

"galsaba" wrote in message
ups.com...
Then how should i convert it to a real date?

Galsaba

Jason Morin wrote:
For the first 2 dates, use:

=--(MID(A1,4,2)&"-"&RIGHT(A1,2)&"-"&MID(A1,2,2))

By the way, 2/30/2001 is not a real date and the formula
will produce an error.

HTH
Jason
Atlanta, GA

-----Original Message-----
I need to do few conversion.
the date in a date field is a string data of this format:
1010230 which indicates 02/30/2001 (101 is 2001)
1051215 indicates 12/15/2005.
How can I convert one to the other?

Also I have
1010230 that I want to convert to a string of YYYYMMDD

and string YYYYMMDD that I want to convert to date

format MM/DD/YY

Thanks,

galsaba

.






All times are GMT +1. The time now is 09:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com