Anyone know how to convert :formatted as text result to date?

Using the formatted as text operator will turn any data type into a text type and only display the values rather than create the values in the same data type.

So when you have date fields in your yes/no sections for the format as text, both are being turned into a text object.

But what you are doing is completely possible, just needs the proper setup and tools.

First here is a quick look at the setup and result

Screen Shot 2021-09-03 at 12.34.17 PM
Screen Shot 2021-09-03 at 12.34.11 PM

Need an option set or at least something that will store the value of Jan 1, 1970…this is what I call ‘dawn of computer time’…I think real term is ‘epoch’…Every date is just a number of milliseconds since that time (once you understand that, you can understand how to manipulate date objects much more easily as they are just numbers).

I have mine in an option set

Then you also need to have a way to get the User’s Timezone UTC offset in minutes…I use free plugin ‘Browser Timezone’…you will also need to multiply that value by -1 to get the correct value to use…I stored mine in a custom state

Screen Shot 2021-09-03 at 12.37.59 PM

So in my example, I have the dynamic expression start with the option set value ‘dawn of computer time’ (Jan 1, 1970)…this is followed a “+ seconds” operator and that value is set to some expression that can evaluate to a yes/no field so I can do the formatted as text

My formatted as text operator just takes current date/time…you would use whatever date values you want for the date, but then do the operator ‘extract’ and extract the unix time stamp (the number of milliseconds since Jan 1, 1970) and then divide that number by 1000 to arrive at a number of seconds since Jan 1, 1970.

From there you now have text data, but need it to be a number so after the formatted as text operator use the ‘convert to number’ operator…now you can follow that with a “+ minutes” operator and that value should be the custom state that is the (-1*UTC offset).

And now you have a date value that you can use

3 Likes