Parsing date from text

Hello,

I’m working on a custom email parser that categorizes and filters and email from a vendor, extracts values based on the filter applied and creates records in SmartSuite accordingly.

Most of the app is created, but i’m having a hard time parsing the date from a text that i am getting from the email.

Usually the text is formatted as such " Wednesday, 30 August" for example.

I know that i need to add a year and that is possible.

But i still cannot parse a date format out of this text.

Can anyone help.

You need to use the parseDate() function and define the format of the input. According to date tokens, the function should look like (for better understanding, I used the example from your question directly in the function) :

parseDate('Wednesday, 30 August', 'dddd, D MMMM', 'Prague/Europe')

where:

  • dddd stays for day in a week
  • D stays for the day in a month, and
  • MMMM stays for the month’s name
  • Prague/Europe is the timezone of the date, this is to ensure that the date is correctly parsed

:exclamation: When setting up the function, ensure, that you enter the timezone in which your system works.

:link: Here is the list of supported tokens at Make.

The code in your app (tab Communication) can look like this:

"response": {
     "output": {
     "{{...}}": "{{omit(body, 'date')}}",
     "date": "{{parseDate(body.date, 'dddd, D MMMM', 'Prague/Europe')}}
   }
}

or you can implement a custom IML function as documented here.

3 Likes

Hi @Alishan_Karasarkissi

Try with the below formula.
{{parseDate(“Wednesday, 30 August”; “dddd, DD MMMM”)}}
Input:
image
Output:
image

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support
Visit us here
Youtube Channel

Thank you both. I thought the parse only accepts Date as a parameter.
It is working now.

3 Likes