18 Replies Latest reply: Aug 2, 2012 9:05 AM by Steven Bain RSS

    Month()/Day() Functions with Leading Zeros?

      Hiya Guys,


      I am writing a user-defined function in a Macro and require Months and Days in the format of "00".


      I assume that, as I am running the function from a Load Script, the following line of code does not work:

      MakeDateKey = ActiveDocument.Evaluate("Num(Year(dat),'0000') & Num(Month(dat),'00') & Num(Day(dat),'00')")


      So how do I convert/format the following so that Month() and Day() will always return a 2-digit number?:






      MakeDateKey = Year(dat) & Month(dat) & Day(dat)