Convert US date-time to UK date format

scarlett3

Board Regular
Joined
Jan 21, 2005
Messages
73
Office Version
  1. 365
Platform
  1. Windows
I have American date-time data, such as the following:

02/01/2019 13:00:00

which is 1pm, 1st February 2019.

Can anyone help with a formula to extract only the date element in UK format?

Thanks.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
The reply above will extract US date only from US date/time cells, and produce the result as text.

To find the best way of dealing with your US/UK conversion, can I ask what version of Excel you are using and what process you are using to get the US dates into your workbook? Presumably they are coming in from some kind of external source?
Also, when the dates come in, are they all text values, or are some of them parsed as (incorrect) dates?

The easiest way to deal with the problem would be to process them during your import procedure, but the method will vary depending on the version. If this is not practical, then if you answer the questions above, I will give you a formula. I presume you want the dates to be valid, numerical, British dates in dd/mm/yyyy format.

Looking forward to your answer.
 
Upvote 0
My apologies, @AlanY, your formula works fine converting US dates to UK ones, but the result is text, and it only works if the (US) day <= 12 because that goes in the UK month position, and if >12 it results in an invalid date, parsed as a text entry.

My formula is:
Code:
=IF(ISNUMBER([COLOR=#ff0000]A2[/COLOR]),DATEVALUE(TEXT([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],"mm/dd/yyyy")),DATE(MID([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],7,4),LEFT([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],2),MID([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],4,2)))
Substitute your reference cell for A2 throughout)

This produces the actual date value (43497 for 1st Feb 2019) which can then be formatted as a date of the desired appearance using the ribbon bar.

The IF function looks for a number (valid but incorrect date). If this is true, it takes the TEXT of this date, in US format, and converts that back into a date using the DATEVALUE function, thus arriving at a UK date. If the entry is NOT a number, then it is text, and you can build a DATE by taking the MID 4 characters, starting with the 7th character, for the year, the LEFTmost 2 characters for the month, and the MID 2 characters, starting at the 4th, to give you the day.
 
Last edited:
Upvote 0
My apologies, @AlanY, your formula works fine converting US dates to UK ones, but the result is text, and it only works if the (US) day <= 12 because that goes in the UK month position, and if >12 it results in an invalid date, parsed as a text entry.

My formula is:
Code:
=IF(ISNUMBER([COLOR=#ff0000]A2[/COLOR]),DATEVALUE(TEXT([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],"mm/dd/yyyy")),DATE(MID([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],7,4),LEFT([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],2),MID([COLOR=#ff0000][FONT=Verdana]A2[/FONT][/COLOR],4,2)))
Substitute your reference cell for A2 throughout)

This produces the actual date value (43497 for 1st Feb 2019) which can then be formatted as a date of the desired appearance using the ribbon bar.

The IF function looks for a number (valid but incorrect date). If this is true, it takes the TEXT of this date, in US format, and converts that back into a date using the DATEVALUE function, thus arriving at a UK date. If the entry is NOT a number, then it is text, and you can build a DATE by taking the MID 4 characters, starting with the 7th character, for the year, the LEFTmost 2 characters for the month, and the MID 2 characters, starting at the 4th, to give you the day.

well spotted, thanks
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

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