string to date conversion

arkiboys 9,621 Reputation points
2022-05-17T08:50:15.9+00:00

in dataflow, the select transform shows columns.
some of them are date columns but datapreview shows as string because they are coming in from .json files.
I would like to convert the date columns to date datatype
the sink at present is delta parquet

Question:
When I try to convert the date string to date, I see null in datapreview of derived column.
This is what I am using in derived column:

toDate(columnName, 'dd-MM-yyyy')

Any suggestions?

202640-image.png

202701-image.png

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

Accepted answer
  1. KranthiPakala-MSFT 46,422 Reputation points Microsoft Employee
    2022-05-17T23:15:00.333+00:00

    Hello @arkiboys ,

    Thanks for the question and using MS Q&A platform.

    From the above screenshots, looks like your source date format is yyyy-MM-dd (example date from your picture -> 2022-04-26) but in your derived column expression language you are using dd-MM-yyyy in toDate function which is why you are seeing nulls

    Instead of toDate(columnName, 'dd-MM-yyyy') please try with toDate(columnName, 'yyyy-MM-dd') and it should resolve your issue.

    Reference doc: Mapping data flow expressions usage#toDate

    202951-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful