+ Reply to Thread
Results 1 to 3 of 3

Crop Time from Date and Time Cell

  1. #1
    Registered User
    Join Date
    10-18-2003
    Posts
    22

    Crop Time from Date and Time Cell

    In a cell I have this info: "8/29/2008 5:40:40 PM" pasted in from a website. It has the custom format "m/d/yyyy h:mm" I would like to eliminate the time from the cell, but when I try to use "=LEFT()," the format goes to a weird number. I have tried changing the format of that cell to "m/d/yyyy" but no luck. Any ideas on how to remove the time while preserving the date would be appreciated. Thanks.

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Crop Time from Date and Time Cell

    There are several options: here are two

    1. LEFT(A1,5) - format the cell to the desired date

    2. =DATE(YEAR(A1),MONTH(A1),DAY(A1))
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Crop Time from Date and Time Cell

    It's not clear if the values imported are true date time values (ie ISNUMBER(cell) returns TRUE) or not.

    If they are true datetime values (ie ISNUMBER returns True) then to use LEFT you would need to coerce the output before you could format result as date, eg:

    =0+LEFT(A1,5)

    Another alternative would be:

    =INT(A1)

    Given Dates are Integers & Time is Decimal

    ie you can just as easily retrieve only the time by pulling the decimal remainder

    =MOD(A1,1)
    format accordingly

    If ISNUMBER returns FALSE then you will need to use an alternative approach, which will in part depend on your locale.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1