+ Reply to Thread
Results 1 to 5 of 5

Converting 16 digit numbers to a date format

  1. #1
    Registered User
    Join Date
    08-09-2011
    Location
    Bay Village, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    55

    Converting 16 digit numbers to a date format

    I've been given date data as 14 (not 16) digit numbers: year(4), month(2),day(2), hour(2), minute(2), and second(2). I need to convert these fields to date formats so that I can identify day and hour and also compare times for two different fields. I'm stuck! Thanks so much.
    Last edited by koochandkai; 05-17-2012 at 10:45 AM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Converting 16 digit numbers to a date format

    Try

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

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

    Re: Converting 16 digit numbers to a date format

    You could use TEXT function, e.g. with data in A1 use this formula in B1

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

    format B1 in required date/time forrmat e.g. d/m/yyyy hh:mm:ss
    Audere est facere

  4. #4
    Registered User
    Join Date
    05-17-2012
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Converting 16 digit numbers to a date format

    You'll need to break the Date (yyyy/mm/dd) and the Hours (hh:mm:ss) apart. I would use...

    =TEXT(LEFT($A1,8),"0000-00-00")+TEXT(RIGHT($A1,6),"00\:00\:00")


    DATE(1) FORMULA =TEXT(LEFT($A2,8),"0000-00-00")+TEXT(RIGHT($A2,6),"00\:00\:00")
    DATE(2) FORMULA =TEXT(LEFT($B2,8),"0000-00-00")+TEXT(RIGHT($B2,6),"00\:00\:00")
    DIFF FORMULA = DATE(2) - DATE(1)

    RESULTS...

    DATE (1) DATE (2) DATE (1) FORMULA DATE (2) FORMULA DAYS DIFF
    EX1 20120516000000 20120517000000 2012-05-16 00:00:00 2012-05-17 00:00:00 1.00
    EX2 20120516111535 20120517111535 2012-05-16 11:15:35 2012-05-17 11:15:35 1.00
    EX3 20120416122000 20120517111535 2012-04-16 12:20:00 2012-05-17 11:15:35 30.96

    Hope this helps!
    PMizzel
    Attached Files Attached Files
    Last edited by pmizzel; 05-17-2012 at 11:41 AM. Reason: Added Attachment

  5. #5
    Registered User
    Join Date
    08-09-2011
    Location
    Bay Village, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Converting 16 digit numbers to a date format

    The first two suggestions worked like a charm (so I haven't even tried the third yet). Thanks so much.

+ 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