Azure Data Factory: Date Conversion

Abhishek Vyas 101 Reputation points
2020-10-22T14:26:22.023+00:00

I am creating a pipeline where the source is csv files and sink is SQL Server.

The date column in CSV file may have following values like

12/31/2020
10162018
20201017
31/12/1982
1982/12/31

I do not find the function which checks the format of the date.
How do I check the format and convert the above values to 'yyyy-MM-dd' format.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,458 questions
0 comments No comments
{count} votes

Accepted answer
  1. HimanshuSinha-msft 19,376 Reputation points Microsoft Employee
    2020-10-22T22:47:58.28+00:00

    Hello @Abhishek Vyas

    Thanks for the ask and also using the Microsoft Q&A.
    I was able to get this solution working using mapping dataflow(MDF).
    We need to use the derived column , todate and coalesce function.

    coalesce(toDate(Somedate,'MM/dd/yyyy'),toDate(Somedate,'yyyy/MM/dd'),toDate(Somedate,'dd/MM/yyyy'),toDate(Somedate,'MMddyyyy'),toDate(Somedate,'yyyyddMM'),toDate(Somedate,'MMddyyyy'),toDate(Somedate,'yyyyMMdd'))  
    

    Please find the attached below to get the implementation . Please do let me know how it goes .

    34358-dateissue.gif

    Thanks Himanshu
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    5 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Venkata Subbaiah Kuruva 26 Reputation points
    2021-07-15T14:02:30.003+00:00

    Hi Team,

    How to convert epoch timestamp to datetime in Azure data factory
    suppose i have values like below
    epocdatetime
    1626190402
    1626190400
    Please help

    0 comments No comments