Convert string WED FEB 23, 2009 to yyyy/mm/dd

kpaull

New Member
Joined
Apr 18, 2008
Messages
20
I have a file with the following string in the date field:

"8:26 am TUE FEB 24, 2009", how can I change this field to a string with yyyy/mm/dd HH:MM (24hr format)?

Thanks,
Kurtis
 
Hello Kurtis,

I tested with both types of times and it worked for me, the TRIM function should sort that out, but perhaps instead of spaces you have CHAR(160) in the text string, does this version work?

=TRIM(MID(SUBSTITUTE(A1&" "&A1,CHAR(160)," "),13,LEN(A1)-3))+0
 
Upvote 0

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Barry, still shows #VALUE! for <TABLE style="WIDTH: 134pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=179 border=0 x:str><COLGROUP><COL style="WIDTH: 134pt; mso-width-source: userset; mso-width-alt: 6546" width=179><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD id=td_post_1879954 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 134pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=179 height=17 x:str="'10:09 am FRI MAR 13, 2009">10:09 am FRI MAR 13, 2009</TD></TR></TBODY></TABLE>and works fine for <TABLE style="WIDTH: 134pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=179 border=0 x:str><COLGROUP><COL style="WIDTH: 134pt; mso-width-source: userset; mso-width-alt: 6546" width=179><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD id=td_post_1879954 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 134pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" width=179 height=17 x:str="'9:20 am THU MAR 12, 2009">9:20 am THU MAR 12, 2009</TD></TR></TBODY></TABLE>

Not sure about spacings vs. any special characters. I suspect it doesn't have any special characters.

Weird, eh?

Kurtis
 
Upvote 0
Is the issue a LEADING space?

Try this:
Code:
=--TRIM(MID(TRIM(A1&" "&A1),13,LEN(TRIM(A1))-4))code]
Does that work?
 
Last edited:
Upvote 0
..but wouldn't a leading space also cause Ron's original suggestion to fail? Perhaps that needs some TRIMming too :)
 
Upvote 0
..but wouldn't a leading space also cause Ron's original suggestion to fail? Perhaps that needs some TRIMming too :)
Yup...But, with the new circumstances, I'd use this formula to maintain international compatibility:
Code:
=--(SUBSTITUTE(TRIM(RIGHT(TRIM(A1),8)),", "," "&MID(TRIM(A1),
FIND(",",TRIM(A1))-6,4))&" "&LEFT(A1,8))

That formula properly translates each of these strings:
Code:
" 9:19 am THU MAR 19, 2009 "
" 9:19 am THU MAR 19, 2009"
"9:19 am THU MAR 19, 2009 "
"9:19 am THU MAR 19, 2009"
" 10:18 pm THU MAR 19, 2009 "
" 10:18 pm THU MAR 19, 2009"
"10:18 pm THU MAR 19, 2009 "
"10:18 pm THU MAR 19, 2009"
" 9:05 am THU MAR 5, 2009 "
" 9:05 am THU MAR 5, 2009"
"9:05 am THU MAR 5, 2009 "
"9:05 am THU MAR 5, 2009"
" 10:18 pm THU MAR 5, 2009 "
" 10:18 pm THU MAR 5, 2009"
"10:18 pm THU MAR 5, 2009 "
"10:18 pm THU MAR 5, 2009"
 
Upvote 0

Forum statistics

Threads
1,214,981
Messages
6,122,565
Members
449,089
Latest member
Motoracer88

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