Skip to main content

How to get (0) IN front of month and Day as i am using below calculation for the date field format 

str(DATEPART('month',[Start])) + "-" + str(DATEPART('day',[Start])) + "-" + str(DATEPART('year',[Start]))

 

Can some one Reply with answer thanks in advance

2 answers
  1. Sep 2, 2022, 7:49 PM

    @Mukul Bajpai​ 

    Hi, you can use:

    IF MONTH([Start])<10 THEN "0"+STR(MONTH([Start])) ELSE STR(MONTH([Start])) END +

    "-" +

    IF DAY([Start])<10 THEN "0"+STR(DAY([Start])) ELSE STR(DAY([Start])) END

    + "-" + STR(YEAR([Start]))

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000