dataflow - 0 infront of month

arkiboys 9,686 Reputation points
2022-04-12T11:38:18.663+00:00

This is what I am using in dataflow sink - expression to get the month number. But I would like to get 0 if it is a single digit month
'/month=', toString(month(toDate($p_CurrerntDate))) --> gives 4 whereas I would like to see 04
and if it is a two digit month then leave it as is.
p.s.
$p_CurrerntDate example --> '2022-04-12'
Thank you

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

Accepted answer
  1. KranthiPakala-MSFT 46,442 Reputation points Microsoft Employee
    2022-04-12T23:04:32.953+00:00

    Hello @arkiboys ,

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

    You can use the below expression to achieve your requirement:

    toString(toDate(Date, 'yyyy/MM/dd'), 'MM')  
    

    192429-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

0 additional answers

Sort by: Most helpful