+ Reply to Thread
Results 1 to 11 of 11

how to format date and time this way?

  1. #1
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    how to format date and time this way?

    hi all,

    I need to convert a date&time combined in one cell into 2 parts, combined in 2 cells, i've uploaded an .xls with all explained... not sure how to do this, please let me know

    many thanks and marry christmas!
    Alex
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to format date and time this way?

    Try

    Date
    =TEXT(SUBSTITUTE(LEFT(A2,10),":","/"),"dd.mm.yyyy")
    You my have to reverse the dd.mm to mm.dd depending on your regional settings, and if the original string's date is Dec 11th or Nov 12th.

    And the time
    =SUBSTITUTE(MID(A2,12,8),":","")

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to format date and time this way?

    this formula in H2 should take care of your date... =MID(A2,9,3)&MID(A2,6,3)&LEFT(A2,4)
    still working on your time.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: how to format date and time this way?

    Your time conversions don't make sense (to me).

    19:08:52.19 = 190845 - - - shouldn't that be 190852
    19:08:52.42 = 190841 - - - shouldn't that be 190852
    19:08:51.86 = 190835 - - - shouldn't that be 190851
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to format date and time this way?

    this is close on your time but I can't tell where your last two values for the time are coming from...
    =MID(A2,12,2)&MID(A2,15,2)&RIGHT(A2,2)

  6. #6
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: how to format date and time this way?

    thank you guys, but it gets already confused... as in the last formula there is an A2 while in the spreadsheet the date starts in A3, that's why i uploaded the file, could you be so kind to actually apply the working formula in the excel spreadsheet i've attached and attach it back?

    thank you!

  7. #7
    Forum Contributor
    Join Date
    11-10-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    260

    Re: how to format date and time this way?

    thank you guys, but it gets already confused... it doesn't work...as in the last formula there is an A2 while in the spreadsheet the date starts in A3, that's why i uploaded the file, could you be so kind to actually apply the working formula in the excel spreadsheet i've attached and attach it back?

    thank you!

  8. #8
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to format date and time this way?

    here is your sheet back. clearly the sheet I downloaded has the data beginning in A2, hence the formula.
    Attached Files Attached Files

  9. #9
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: how to format date and time this way?

    Here you go.

    Again, you may need to reverse the dd.mm to mm.dd depending on your regional settings, and if that date is Dec 11th or Nov 12th..
    Also repeating Tony's observation, that I don't see how you got 190845 from 19:08:52.19

    excel question.xlsx

  10. #10
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.96 for Mac MS 365
    Posts
    8,693

    Re: how to format date and time this way?

    Wow, getting old, (just over 2 wks away from 60) but I just noticed that in his original attachment he changed the : to . in his desired output. Now I see why Jonmo gave you the substitute formula.


    So if you adjust my first (date) mid formula to add this, it seems to work out for you.
    =SUBSTITUTE(MID(A2,9,3)&MID(A2,6,3)&LEFT(A2,4),":",".")
    Last edited by Sam Capricci; 12-24-2014 at 11:50 AM.

  11. #11
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: how to format date and time this way?

    These formulas will preserve the numerical values of Date and Time

    For Date

    =SUBSTITUTE(LEFT(A2,10),":","-")+0

    Format Custom, d.m.yyyy

    For Time

    =MID(A2,12,8)+0

    Format Custom, hhmmss

    Row\Col
    H
    I
    1
    Date
    Time
    2
    12.11.2014
    190852
    3
    12.11.2014
    190852
    4
    12.11.2014
    190851
    5
    12.11.2014
    190851
    6
    12.11.2014
    190851
    7
    12.11.2014
    190851
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Convert a date/time format to a date format
    By LITTLETON in forum Excel General
    Replies: 2
    Last Post: 09-23-2013, 10:43 PM
  2. modify date time cell to an excel format date time
    By rileyp in forum Excel General
    Replies: 12
    Last Post: 03-24-2013, 08:39 PM
  3. Convert date and time in serial number format to text format
    By nda13112 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-11-2013, 02:45 PM
  4. [SOLVED] How do I convert imported date/time data to date/time format?
    By andykent99 in forum Excel General
    Replies: 4
    Last Post: 01-03-2013, 07:47 AM
  5. Remove time from a date and time field? Format removes the displa.
    By oaoboc in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2005, 03:35 PM

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