Extract time from DateTime format

ascalise

New Member
Joined
Oct 8, 2015
Messages
21
Having trouble isolating the time component from some .csv data I'm importing. The datetime comes in as dd-mmm-yyyy hh:mm:ss:000 format, I ran a replace to repair the colon separator between seconds and milliseconds. Now I just want the hh:mm:ss.000 component. I tried to simply reformat with a custom hh:mm:ss.000, but it won't change correctly unless I press manually enter in every cell which isn't feasible for some of my larger datasets.

I have an example workbook I can share, but I can't download XL2BB to this system. Here's a screenshot of some of the data:

1620222933989.png
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Another option:
Excel Formula:
=B2-INT(B2)
and format cell in "hh:mm:ss" format.
 
Upvote 0
Solution
Another option, which will do it wihtout the helper column
Excel Formula:
=MOD(SUBSTITUTE(A2,":",".",3)+0,1)
 
Upvote 0
You are welcome.
Glad we could help.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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