Convert European date and time to US date and time

Don2415

New Member
Joined
Dec 27, 2021
Messages
9
Office Version
  1. 2016
Platform
  1. Windows
I'm sure there is a simple solution, but ...

I have a column of European dates/times (real dates, not text) in a cvs file as d/m/yyyy h:mm and I want to convert it to m/d/yyyy h:mm. I see how to do it if it was only d/m/yyyy but including time messes me up.

thanks
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
"I see how to do it if it was only d/m/yyyy " How would you do it?

With the CSV, format the column to General or Custom format as dd-mmm-yyyy hh:mm
Save the file to Excel such as xlsx or xlsm
Format the column to your preference such as m-d-yy hh:mm or m/d/yyyy hh:mm
 
Last edited:
Upvote 0
You need to read the csv as text.You have no example, so here is roughly how it can be done. I'm assuming:
1) Your system is EU date format
2) The csv data is like this in date/time format 4/1/2022 13:00 (d/m/yyyy) in range A1.

Run the code with csv file opened.

VBA Code:
Sub ImportDate()

Dim d As Date, t As Date
Dim wbSource As Workbook, wbDest As Workbook
Dim wsSource As Worksheet, wsDest As Worksheet

Set wbSource = Workbooks("Date.csv")  ' Rename accordingly
Set wbDest = ActiveWorkbook

Set wsSource = wbSource.Sheets("Sheet1")
Set wsDest = wbDest.Sheets("Sheet1")

d = DateValue(wsSource.Range("A1").Text)
t = TimeValue(wsSource.Range("A1").Text)
With wsDest.Range("A1")
    .NumberFormat = "M/d/yyyy  hh:mm"
    .Value = Month(d) & "/" & Day(d) & "/" & Year(d) & " " & t
End With

End Sub
 
Upvote 0
"I see how to do it if it was only d/m/yyyy " How would you do it?

With the CSV, format the column to General or Custom format as dd-mmm-yyyy hh:mm
Save the file to Excel such as xlsx or xlsm
Format the column to your preference such as m-d-yy hh:mm or m/d/yyyy hh:mm
Thanks, but this did not work.
 
Upvote 0

Forum statistics

Threads
1,215,036
Messages
6,122,796
Members
449,095
Latest member
m_smith_solihull

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