Discussions

Expand all | Collapse all

Converting Month & Year (Text) to Date Field

  • 1.  Converting Month & Year (Text) to Date Field

    Posted 02-14-2019 22:58
    Hi,

    I have a text field [Invoice Month] (reads "January 2019", "February 2019", etc) that I need to reformat into a date format. (January 2019 to 01/01/2019). What is the best way to do this?

    Thanks! 


  • 2.  RE: Converting Month & Year (Text) to Date Field

    Posted 02-14-2019 23:33
    This should work as a formula date field

    var number YYYY = ToNumber(Trim(Right([Invoice Date], " ")));

    var text MonthName = Trim(Left([Invoice Date], " "));

    var number MM = Case($MonthName,
    "January", 1,
    "February", 2,
    "etc", 99,
    "December", 12);

    Date($YYYY,$MM,1)






  • 3.  RE: Converting Month & Year (Text) to Date Field

    Posted 02-15-2019 14:28
    Thank you! This worked perfectly!