Unable to convert to Timestamp in dataflow

Krishnamohan Nadimpalli 406 Reputation points
2022-12-27T12:32:34.963+00:00

Hi

I am trying to convert to yyyy-MM-dd format using toTimestamp or toDate in dataflow. In the below figure, I am trying to get the yyyy-MM-dd from file_name. Substring works but toTimestamp always gives null values. My sink is Timestamp, so I need to convert to Timestamp

274313-image.png

274331-image.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} votes

1 answer

Sort by: Most helpful
  1. HimanshuSinha 19,547 Reputation points Microsoft Employee Moderator
    2022-12-27T23:27:39.97+00:00

    Hello @Krishnamohan Nadimpalli ,
    Thanks for the question and using MS Q&A platform.
    As we understand the ask here is how to get the string converted to tuimestamp, please do let us know if its not accurate.
    I am confident that the you are missing the data format which you are passing as an input .

    This expression should work .
    In my case filename ='27122022'

    toTimestamp(concat(substring($filename,5,4),'/',substring($filename,3,2),'/',substring($filename,0,2)),'yyyy/MM/dd')

    274319-image.png

    If you do not pass the dateformat it does give NULL .

    274310-image.png

    Please do let me if you have any queries.
    Thanks
    Himanshu


    • 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
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.