ADF Dataflow

Maneesha John 21 Reputation points
2022-10-19T07:42:53.147+00:00

I need to trim date from datetime column in dataflow. How to do that?

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

2 answers

Sort by: Most helpful
  1. SSingh-MSFT 16,371 Reputation points Moderator
    2022-10-20T07:08:15.647+00:00

    Hi @Maneesha John ,

    Welcome to Microsoft Q&A platform and thanks for using Azure Services.

    As I understand your question, you want to extract Date from Datetime(Timestamp) column using Data Flow.

    Let us say we have Input Dataset with Datetime column, we can make sure the Type in Projection tab of the Source is string:

    252220-datetimesource.gif

    Source Dataset looks like:

    252361-image.png

    Next, we will use Derived Column transformation and in the expression builder we will write the expressions as:

    1). If we want output column to be of Date Type, then toDate(LoginTime, 'dd/mm/yyyy') :

    252345-datetimederivedcol.gif

    2). If we want output column to be of String Type, then use toString(toDate(LoginTime, 'dd/mm/yyyy'),'yyyy-MM-dd'):

    252305-datetimederivedcol1.gif

    If needed to convert to Date type, use toDate(toString(toDate(LoginTime, 'dd/mm/yyyy'),'yyyy-MM-dd'),'yyyy-MM-dd')

    3). If need is to extract Date in some particular format, for example as dd-MM-yyyy, the use toString(toDate(LoginTime, 'dd/mm/yyyy'),'dd-MM-yyyy')

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

  2. Maneesha John 21 Reputation points
    2022-10-20T08:19:05.297+00:00

    Sorry if i didnt made my question clear. I need only time from datetime portion as my sql table has the datatype as time.


Your answer

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