Exon02
Exon02

Reputation: 77

Check if time is past a predefined time

I have a flow where a user can fill in a datetime, i wish to check if the input date is not in the past and if the submission date time is less than today at 10:40 AM.

So i have to get the date from the inputfield en and the time from the submissiondate and check if they are less than today at 10:40am.

Which is the best way to achive this?

Upvotes: 0

Views: 517

Answers (1)

Skin
Skin

Reputation: 11252

This isn't a complete solution but it gives you the kind of pattern you should consider.

I've broken it out for ease. This is the flow with the expressions at each step ...

Flow

I've converted the date and time to my own regional location, you should ultimately do the same.

Step 1 - Initialize Current DateTime (String)

formatDateTime(convertFromUtc(utcNow(), 'AUS Eastern Standard Time'), 'dd/MM/yyyy h:mm tt')

Step 2 - Initialize Today 10:40 AM (String)

concat(formatDateTime(convertFromUtc(utcNow(), 'AUS Eastern Standard Time'), 'dd/MM/yyyy'), ' 10:40 AM')

Step 3 - Initialize Date Comparison (Boolean)

less(parseDateTime(variables('Current DateTime')), parseDateTime(variables('Today 10:40 AM')))

The last step will produce the boolean comparison result that you can use in subsequent actions.

Upvotes: 1

Related Questions