Date format from mm/dd/yyyy hh:mm:ss AM/PM to dd/mm/yyyy

ggirf14

New Member
Joined
Nov 8, 2016
Messages
49
I cannot find an exact answer to handle the following dates:
3/30/2012 12:00:00 AM
04/02/2012 12:00:00 AM

Using Excel 2016 I tried
1- Formatting with custom dates including [$-409]mm/dd/yyyy hh:mm:ss AM/PM;@
2- Various versions of LEFT(TRIM(RIGHT(SUBSTITUTE...
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi,

If the Date strings are Real Dates (meaning numbers for Excel), just changing the Cell formatting to Date or dd/mm/yyyy should work, unless it's actually TEXT, then you can try and see if DATEVALUE would help, see following samples:


Excel 2010
ABCDEFGH
103/30/2012 12:00:00 AM3/30/20123/30/2012 12:00:00 AM3/30/2012
204/02/2012 12:00:00 AM4/2/20124/2/2012 12:00:00 AM4/2/2012
3
4Formatdd/mm/yyyy hh:mm:ss AM/PMDateTEXTDate
Sheet21
Cell Formulas
RangeFormula
H1=DATEVALUE(F1)


Column B are Real Dates, Column F is TEXT.
 
Last edited:
Upvote 0
Source file is CSV and yes they are formated as text,
with formula =DATEVALUE(F1) I get an error message #Value ! on rows left aligned and right aligned.
Looking at data with notepad I see the following with double quotes and coma: ,"3/16/2012 12:00:00 AM",
I cannot see those caracters when opening with Excel.
 
Upvote 0
I don't deal with CSV files, so don't come in contact with "Hidden Characters" much, but see if this helps:


Excel 2010
AJKL
1,"3/16/2012 12:00:00 AM",3/16/2012
2
3
4FormatYour Source DataDate
Sheet21
Cell Formulas
RangeFormula
L1=SUBSTITUTE(SUBSTITUTE(J1,",",""),CHAR(34),"")+0
 
Upvote 0
Same result with =DATEVALUE(SUBSTITUTE(SUBSTITUTE(O185,",",""),CHAR(34),"")+0)

Try taking OUT Datevalue, use only:

=SUBSTITUTE(SUBSTITUTE(O185,",",""),CHAR(34),"")+0
 
Upvote 0
Still same issue with
=SUBSTITUTE(SUBSTITUTE(O185,",",""),CHAR(34),"")+0

 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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