+ Reply to Thread
Results 1 to 14 of 14

Date & time conversion

  1. #1
    Registered User
    Join Date
    03-30-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    14

    Date & time conversion

    Hello
    I have some data from a temperature logger and for some reason in some of the downloaded files the date format has switched to the US format (mm/dd/yyyy hh:mm) when i need it in UK format (dd/mm/yyyy hh:mm)

    As if this wasnt tricky enough, about halfway down the data table the date changes format to an even trickier one (mm/dd/yyyy hh:mm:ss AM/PM) which i also need to convert to UK format.

    The first case data type seems to be 'custom' and the second one is 'general'.

    Attached is a sample of the date column where it changes from one unwanted format to the other.

    Please help
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-29-2013
    Location
    Pattaya, Thailand
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Date & time conversion

    He Andy,

    Just select the cells/columns with the dates and select "more number formats" in a dropdown list on the home tab (sorry if it's not called that way, I'm on excel 2013)
    It probably displays as "date" in that dropdown list at the moment. Then select "custom" and on the right in the "type" box, type the format you want:
    dd/mm/yyyy hh:mm


    edit: I just downloaded your sample and I understand your issue a bit better now...
    That's pretty weird... the format doesn't seem to apply to the bottom part with US formatting.

    I'll be back in a bit and try to figure out what's wrong.

    Cheers,

    Michael.
    Last edited by vayana; 12-25-2013 at 07:07 PM.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Date & time conversion

    Changing format wont work here, the cells in question are text, not numeric...all formats do is change how the data is displayed, not the underlying contents

    Try this instead....

    Highlight the entire range
    select Data Tab/Text2Columns
    click next...next...(doesnt matter what delimiter was selected)
    in the 3rd box, check "DATE", and select your format
    click FINISH
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    11-29-2013
    Location
    Pattaya, Thailand
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Date & time conversion

    Thanks for the lesson.
    Changing format didn't change how the data was displayed either, I tried a bunch of them. I knew dates were actually just numbers in excel, which should have rang a bell. Pretty weird his data somehow got imported in 3 different ways though.

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Date & time conversion

    Perhaps in the raw data, there is an extra space or something somewhere
    I have some data from a temperature logger
    so who knows how that import could affect some data?

    That T2C trick is very useful to remember - it wont affect real dates, and will often "fix" text dates
    This would also have worked in a helper column, but is not needed in this case
    =DATEVALUE(A1)

  6. #6
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Date & time conversion

    I followed the following procedure and got Excel recognizable dates and times.

    Select the text dates. Go to Data, Text to Columns, choose Delimited, Next, choose Space. Next
    Select the column with the date part and choose DATE and choose MDY as the format. Click on the AM/PM and do not import.
    Click finish. In C15 enter =A15+B15. Copy the result and Paste Values and Number Formatting. Delete the data in columns B and C produced by this procedure.

    There was an oddity in this procedure that I can't explain. When completing the Paste Values and Number formatting procedure, the Date in column B changed by adding one day to the result but the copy was correct
    Last edited by newdoverman; 12-25-2013 at 08:49 PM.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

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

    Re: Date & time conversion

    hi andy. try this in B2 & copy down:
    =IFERROR(TEXT(TEXT(A2,"yyyyddmm"),"00-00-00")+MOD(A2,1),DATE(20&MID(A2,7,2),LEFT(A2,2),MID(A2,4,2))+MID(A2,FIND(" ",A2)+1,11))

    Edit: if you see numbers, format cells to your desired format

    @newdoverman:
    can't seem to replicate your scenario.
    Copy the result and Paste Values and Number Formatting. Delete the data in columns B and C produced by this procedure.

    There was an oddity in this procedure that I can't explain. When completing the Paste Values and Number formatting procedure, the Date in column B changed by adding one day to the result but the copy was correct
    i thought column B has the time & C has the formula? so i deleted A & B instead after copying & pasting values to C. i did get the correct results
    Last edited by benishiryo; 12-25-2013 at 09:26 PM.

    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

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Date & time conversion

    @benishiryo.... My end results were good but the values that I copied for some reason changed to 1 day in advance after I copied them. I tried it several times and it did the same thing every time. If I hadn't seen it, I wouldn't have believed it...maybe too much wine for supper.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Date & time conversion

    My straight-forward T2C worked fine, for the entire data range?

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

    Re: Date & time conversion

    @newdoverman:
    yeah, and i couldn't replicate it. you might be right about the drinks~

    @Ford:
    it doesn't if you change your Date Region settings to DMY (like me & probably both OP & newdoverman).

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Date & time conversion

    No, that is what I set it to (DMY)...thats what they needed, and they come from UK, so thats the format they would use

  12. #12
    Registered User
    Join Date
    03-30-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Date & time conversion

    Thanks for the suggestions.
    I may try some of them out just to see if this error with my data loggers (ibuttons) can be quickly adjusted for in the future.
    I actually got around it this time by simply typing in the correct format date and time and dragging down so that excel automatically generates a column full of data.
    I only have to do it 12 times so it wasnt too onerous.

  13. #13
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Date & time conversion

    My settings as suspected are DMY. Sometimes this gets in the way if converting to or from MDY. In that case I change to the serial number and reformat as needed as the serial number is the basis of all date presentations.

  14. #14
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Date & time conversion

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. [SOLVED] Need help with Date/Time Conversion
    By knilsson in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-02-2014, 07:13 PM
  2. Date and time conversion to another time zone
    By RUBEN PARRAS in forum Excel General
    Replies: 1
    Last Post: 05-21-2012, 09:03 PM
  3. Date and Time conversion to hours?
    By hainsworth in forum Excel General
    Replies: 7
    Last Post: 11-04-2010, 12:51 PM
  4. conversion of text to time and date
    By afgi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2010, 12:08 PM
  5. date/time conversion
    By rfcomm2k in forum Excel General
    Replies: 3
    Last Post: 03-22-2009, 08:31 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