+ Reply to Thread
Results 1 to 7 of 7

Changing number to date time format

  1. #1
    Registered User
    Join Date
    12-05-2012
    Location
    New York
    MS-Off Ver
    Excel 2011 for Macs, version 14
    Posts
    2

    Changing number to date time format

    Hello,

    I recently downloaded some data that includes a column of date time information. The date time appears as one number (ex: 201206010053 for 2012-06-01 00:53). I though that I could change the number into a date time format by using the custom option under the format cells number option. However, I entered yyyy-mm-dd hh:mm into the custom format option and got ############# as the output for the date times. Any suggestions of what I must do to change 201206010053 to 2012-06-01 00:53?

    Thank you!

    Screen shot 2012-12-05 at 9.46.47 AM.png

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Changing number to date time format

    hi Saw-whet Owl, welcome to the forum. use this formula to convert them into a proper format first:
    =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIMEVALUE(MID(A1,9,2)&":"&RIGHT(A1,2))
    you can then change them to your custom formatting

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    521

    Re: Changing number to date time format

    =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,9,2),MID(A1,11,2),RIGHT(A1,2))

    this will give you 6/1/2012
    then change the date format to 3/14/01 13:30

  4. #4
    Registered User
    Join Date
    12-05-2012
    Location
    New York
    MS-Off Ver
    Excel 2011 for Macs, version 14
    Posts
    2

    Re: Changing number to date time format

    Fantastic! Thank you Benishyrio and VKS!

  5. #5
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Changing number to date time format

    You could use this formula

    =TEXT(A1,"00-00-00 00\:00")+0

    then custom format as required
    Audere est facere

  6. #6
    Registered User
    Join Date
    02-14-2011
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Changing number to date time format

    Quote Originally Posted by VKS View Post
    =DATE(LEFT(A1,4),MID(A1,5,2),MID(A1,7,2))+TIME(MID(A1,9,2),MID(A1,11,2),RIGHT(A1,2))

    this will give you 6/1/2012
    then change the date format to 3/14/01 13:30
    My data is not returning the correct dates when I use this formula. Would someone please help me manipulate the formula so that I can get the correct dates? The data is in MDY and is either 5 or 6 digits for instance 80601 for August 6, 2001. Or 100300 for October 3, 2000 (the data is recovered data from an ancient computer system and didn't always make the transition in usable format).

    Thanks!

  7. #7
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Changing number to date time format

    Try modifying my suggestion

    =TEXT(A1,"00-00-00")+0

    Then format in any date format you want

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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