Excel 2010/2013
Excel 2007
Excel 2003
Tips & Tricks
Excel Forum
Course Index CIG Excel Book
 
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
 

News      User Comments     History     Notify Me

5/19/2008 1:11:52 PM
Excel: Separating Time & Date
By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

 
Q: How do I remove the date from a cell with both the date and time (the date seems to show up automatically, although I'm only interested in the time). In short, I want to go from "4/7/2008 6:18:00 AM" to "6:18:00 AM". Thanks, Lauren.


A: Lauren, the only easy way I've found to do this is to break up the date/time into its components (day, month, year, etc.) and then put them back together again with the DATE() and TIME() functions.

For example, let's say A1 has: 4/7/2008 6:18:00 AM

Put the following functions in the next cells:

B1 = YEAR(A1)
C1 = MONTH(A1)
D1 = DAY(A1)
E1 = HOUR(A1)
F1 = MINUTE(A1)
G1 = SECOND(A1)

Now put them all back together:

H1 = DATE(B1, C1, D1)
I1 = TIME(E1, F1, G1)

That's about the only easy way to do it and still keep the value as a DATE/TIME and not text (you could do it with string concatenation too, but you would then have to convert it back to a date).

Permanent Link
Keywords: excel tips year month day hour minute second date time
Post Reply

Comment from Sanat @ 8/28/2008
I have a column with the numbers like SS02. How do I make it look like SS-02 in Excel. Thanks.
Show Just This Thread        Post Reply
Comment from Richard Rost @ 7/22/2008
John, that is an EXCELLENT and very elegant solution. I did not think of that. Thank you!
Show Just This Thread        Post Reply
Comment from John Mosher @ 7/15/2008
I've been struggling with this myself because I have a database that was exporting an elapsed time as a date and time. I figured out the following single cell solution.

Assuming the date and time is in cell A1 use the following formula =MOD(A1,1). You can then format the results with whatever time format you want.

This works because the MOD function computes the remainder after dividing by the number to the right of the comma. In this case dividing by 1 leaves only the numbers to the right of the decimal.

In Lauren's example this leaves a decimal of 0.2565. When formatted with the appropriate time function you get the format Lauren is looking for.
Show Just This Thread        Post Reply
Comment from Richard Rost @ 7/1/2008
Jim, you can do that with Window > Freeze Panes. I cover it in Excel 103.
Show Just This Thread        Post Reply
Comment from Hiram Hey @ 7/1/2008
I want to know how to have a static header in xcel. That is the header remains in view when rolling to various parts of the worksheet.Which CD need Purchase?  Regards, Jim Hey
Show Just This Thread        Post Reply
Comment from Richard Rost @ 5/24/2008
Ruby, thank you for the feedback. You are correct... you can apply a custom format like that to VIEW the date or time... but if you want to CHANGE the value (for calculations) so that it's ONLY a date or time, a format alone won't work.
Show Just This Thread        Post Reply
Comment from Richard Rost @ 5/24/2008
Ramon, the easiest thing to do is to visit the Download Center and download the latest copy of the Amicron Video Player. Then, once you have the Player installed click on the MY ACCOUNT button. Log in to your account and you can download all of your courses right from inside the player.
Show Just This Thread        Post Reply
Comment from Ruby Kowaney @ 5/22/2008
If the date is showing up automatically when only time is needed, the cells are probably formatted in either DATE or TIME custom format as:

[$-409]m/d/yy h:mm:ss AM/PM;@

and can simply be changed to

[$-409]h:mm:ss AM/PM;@

so that the date does not show.
Show Just This Thread        Post Reply
Comment from Ramon Salvo @ 5/19/2008
How do you reinstall on my hard disk previous CDs or downloads from 599?
Please provide detailed instruction and I learned a lot from Richard Rost who I believe is a very tech savvy pres.
Show Just This Thread        Post Reply

Add Your Comments or Subscribe
 
If you just want to subscribe to get email updates when the News is updated, then enter your name and email address and check the Notify Me box below. If you would optionally like to add your comments below to be posted, they are welcome.
 
  Your Name:  Required
  Your Email:  NOT Public
  Subject:
  Comments:

 

Sorry about this step. It's just to keep the spam bots away:
  Verify: What is 8+1:
  
  Notify me when the News is updated.
  Remember Me for my next comments
  
 
 
Please do not use this form for Customer Service inquiries! If you have questions about your account, shipping info, courses you've ordered, need passwords, etc. please use the Customer Service Center instead.

I value your comments. They will be displayed on this page (above). Your name will be displayed, but your email address will not be.
As always, I promise to never give away your personal information to anyone else, ever.

NOTE: If you don't leave your name and email address, DON'T expect a reply. I can't promise a personal reply to everyone who posts here. I TRY my best, but I cannot guarantee it. If you don't leave your real name and email address, I won't even bother. I usually just hit DELETE. -Richard

 

 

You may want to read these articles from the 599CD News:

5/4/2014Microsoft Access Expert 20
3/5/2013Excel Tip: Price Markups
2/3/2013Signed Copies of my Excel Book
9/27/2012Excel Expert 10 Handbook Ready
9/18/2012Two New Excel Tips: Date/Time Differences
6/20/2012Excel Tip: Sum Cells Between Two Values
6/16/2012New Excel Tip: Paste Link
3/26/2012Excel Tip: 2D Matrix Lookups
11/18/2011Dashboards in Excel
10/6/2011Excel Expert 11 On Hold
 

Learn
 
Accessindex
Excelindex
Wordindex
Windowsindex
PowerPointindex
Photoshopindex
Visual Basicindex
ASPindex
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About Us
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Gift CDs
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP