Extract Date and Time from a string

reyemarr

New Member
Joined
Nov 26, 2016
Messages
2
Hi,

I have a column with dates in the following format:

2016-11-10T05:18:47+00:00
2016-11-10T09:59:38+00:00
2016-11-10T11:00:58+00:00
2016-11-10T11:25:00+00:00

<tbody>
</tbody>

I want to extract both the date and time from each string and save them on a separate column each. What is a good formula to accomplish this?

Thanks

MR
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Welcome to the forums. Try out the below, which assumes the month is 11 (Nov) and the day is 10 (Oct).

B2 (format cell as Short Date):
Code:
=DATEVALUE(LEFT(A1,10))

C2 (format cell as Time):
Code:
=TIMEVALUE(MID(A1,12,8))

2016-11-10T05:18:47+00:0011/10/20165:18:47 AM
2016-11-10T09:59:38+00:0011/10/20169:59:38 AM
2016-11-10T11:00:58+00:0011/10/201611:00:58 AM
2016-11-10T11:25:00+00:0011/10/201611:25:00 AM

<tbody>
</tbody>
 
Last edited:
Upvote 0
Assuming you will always have leading zeros, use
=LEFT(B2,10)
for the date and
=MID(B2,12,8)
for the time.
To force Excel to convert the strings into date and time as it understands them, add a -- in front of the function as in =--MID(B2,12,8) and format the cell as desired.
Hi,

I have a column with dates in the following format:

2016-11-10T05:18:47+00:00
2016-11-10T09:59:38+00:00
2016-11-10T11:00:58+00:00
2016-11-10T11:25:00+00:00

<tbody>
</tbody>

I want to extract both the date and time from each string and save them on a separate column each. What is a good formula to accomplish this?

Thanks

MR
 
Last edited:
Upvote 0
In B1, formula copy across to C1

=--SUBSTITUTE(LEFT($A1,19),"T"," ")

format B1 as Date, C1 as Time, and all copy down.

Regards
 
Upvote 0
Enter formula in B1 and copy across to C1 and then down
Format Col B as Date and Col C as Time

=--TRIM(MID(SUBSTITUTE(LEFT($A1,FIND("+",$A1)-1),"T",REPT(" ",99)),99*(COLUMNS($A:A)-1)+1,99))

Book1
ABC
12016-11-10T05:18:47+00:0011/10/20165:18:47 AM
22016-11-10T09:59:38+00:0011/10/20169:59:38 AM
32016-11-10T11:00:58+00:0011/10/201611:00:58 AM
42016-11-10T11:25:00+00:0011/10/201611:25:00 AM
Sheet1
 
Upvote 0
Here is another one
Enter formula in B1 and copy across to C1 and then down
Format Col B as Date and Col C as Time

=CHOOSE(COLUMNS($A:A),--LEFT($A1,10),--MID($A1,12,8))
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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