+ Reply to Thread
Results 1 to 6 of 6

Multiple Date Format Conversion (with Text versions)

  1. #1
    Registered User
    Join Date
    04-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    17

    Question Multiple Date Format Conversion (with Text versions)

    Hello and thank you ahead for the assistance.

    I'm at a loss now in how to convert what seems to be a set of raw dates that are in multiple formats from a SQL database., they are unfortunately organised in multiple ways:
    yyyy-mm-dd (e.g 2023-01-18)
    mmm dd yyyy h:mm AM/PM (e.g Oct 24 2022 4:13PM)
    yyyy-mm-dd hh:mm:ss.00000000 (e.g 2021-11-30 00:00:00.0000000)
    dd/mm/yyyy (e.g 05/07/2010)

    I've tried to convert them on the SQL side using

    COALESCE(TRY_CONVERT(DATE, [Date Raw], 101), TRY_CONVERT(DATE, [Date Raw], 103),TRY_CONVERT(DATE, [Date Raw], 23)) which for the most part works (but errors deciphering between UK and US formats)

    I've tried on Excel side (wanting to utilise both Excel and Power BI)

    using INT, DATEVALUE(TEXT), excelforum.com/excel-general/1133100-changing-a-date-format-that-includes-time-mmm-dd-yyyy-h-mm.html,

    And other options that are lost in my search history. They seem to work if there is a consistent format, but as I am stuck with multiple like the above, there's always a hurdle it gets stuck at.

    Is it possible to convert these into a useable format at all?

    I've attached a workbook with the examples of dates listed with the raw dates, SQL converted dates and date matched column to show where SQL is failing. Examples should include all styles listed above (Original File Size is too large)


    Truly thank you! It's mind boggling and I'm at a loss now.
    Attached Files Attached Files

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Multiple Date Format Conversion (with Text versions)

    Try this monster:


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  3. #3
    Registered User
    Join Date
    04-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    17

    Re: Multiple Date Format Conversion (with Text versions)

    That is truly magical!

    Thank you very much Glenn, works exactly how I needed it too

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,152

    Re: Multiple Date Format Conversion (with Text versions)

    Slighly shorter

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  5. #5
    Registered User
    Join Date
    04-16-2021
    Location
    UK
    MS-Off Ver
    365
    Posts
    17

    Re: Multiple Date Format Conversion (with Text versions)

    Thank you John

  6. #6
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    43,986

    Re: Multiple Date Format Conversion (with Text versions)

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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] Issue with Date conversion from Text to CDate with Format
    By rakotonirinas in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-20-2019, 12:23 PM
  2. [SOLVED] US to UK Date conversion for dates in text format of different lengths
    By Lumisheep in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-07-2016, 08:06 AM
  3. Multiple cell conversion TEXT to DATE
    By ciki022 in forum Excel General
    Replies: 2
    Last Post: 07-28-2015, 02:36 PM
  4. Replies: 1
    Last Post: 06-15-2012, 02:03 PM
  5. Date Format Conversion?
    By Chris in Nebraska in forum Excel General
    Replies: 37
    Last Post: 08-24-2006, 05:08 PM
  6. Conversion of date into different format
    By Fam via OfficeKB.com in forum Excel General
    Replies: 8
    Last Post: 07-31-2006, 04:18 PM
  7. [SOLVED] Date Format - Conversion
    By tinkertoy in forum Excel General
    Replies: 1
    Last Post: 07-14-2005, 02:05 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