Date time to Date conversion

sharshra

Active Member
Joined
Mar 20, 2013
Messages
404
Office Version
  1. 365
In the excel file I received, I have a date column in custom format (01/18/2024 17:14:08). From this, I have to extract the date in yyyymmdd format. I tried using Text & Int functions, but getting incorrect results. Refer the table below. Looks simple, but am I making any mistake? Experts in this forum, can you please advise how can I get the date in yyyymmdd format?

Book1
BCD
1TextInt
201/18/2024 17:14:08yyyy011801/18/2024 00:00:00
Sheet1
Cell Formulas
RangeFormula
C2C2=TEXT(B2,"yyyymmdd")
D2D2=INT(B2)
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
The value in B2 looks like it is stored as a serial number, so when you convert to date only with INT as in D2, the value is correct. You should just need to change the display format.
 
Upvote 0
Your formula works for me here in the US. Is 'y' the letter used in your locale for year? This alternative should work for you no matter what...
Excel Formula:
=TEXT(B2,"emmdd")
 
Upvote 0
Solution
Your formula works for me here in the US. Is 'y' the letter used in your locale for year? This alternative should work for you no matter what...
Excel Formula:
=TEXT(B2,"emmdd")
That´s quick & Brilliant(y) Thanks a lot, Rick. You are right. In my locale, I have to use "aaaammdd" instead of "yyyymmdd" & it works :biggrin:
 
Upvote 0
That´s quick & Brilliant(y) Thanks a lot, Rick. You are right. In my locale, I have to use "aaaammdd" instead of "yyyymmdd" & it works :biggrin:
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,217
Members
452,619
Latest member
Shiv1198

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