EOM using text "MONTH YEAR"

Hi All,

I have a text in the format "Month Year" using this text i want to get end of the month .

Example : 

 Input(Text) : January 2019

Output(date) : 1/31/2019

This is what i could achieve so far but not sure how should i get value "2" which is month (February) . Can somebody help me ?

Thanks in Advance 

  Discussion posts and replies are publicly visible

Parents
  • Hi. It's not particularly elegant, but you can take the components of the incoming date and split them, perform a lookup to swap the text month value for a numeric month value, construct a date based upon the the numeric values you now have (defaulting the day to "01") and then use fn!eom() to get the last day of the month for that date.

    Something like this:

    load(
      local!listOfMonthsText: {
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December"
      },
      local!listOfMonthsInteger: {
        fn!enumerate(12)+1
      },
      local!monthYearComponents: fn!split(ri!monthYear," "),
      local!monthInteger: fn!displayvalue(local!monthYearComponents[1],local!listOfMonthsText,local!listOfMonthsInteger, null),
      fn!eomonth(fn!todate(fn!concat(local!monthInteger, "/01/", local!monthYearComponents[2])),0)
    )

Reply
  • Hi. It's not particularly elegant, but you can take the components of the incoming date and split them, perform a lookup to swap the text month value for a numeric month value, construct a date based upon the the numeric values you now have (defaulting the day to "01") and then use fn!eom() to get the last day of the month for that date.

    Something like this:

    load(
      local!listOfMonthsText: {
        "January",
        "February",
        "March",
        "April",
        "May",
        "June",
        "July",
        "August",
        "September",
        "October",
        "November",
        "December"
      },
      local!listOfMonthsInteger: {
        fn!enumerate(12)+1
      },
      local!monthYearComponents: fn!split(ri!monthYear," "),
      local!monthInteger: fn!displayvalue(local!monthYearComponents[1],local!listOfMonthsText,local!listOfMonthsInteger, null),
      fn!eomonth(fn!todate(fn!concat(local!monthInteger, "/01/", local!monthYearComponents[2])),0)
    )

Children
No Data