Not able to get correct results of time comparison

I am trying to save the string value depending on the value of time attribute. If the time is between 6:30am to 3:15 pm then the value will be A, else if time range is between 3:15pm and 11:59pm then result valu should be B. I am able to get desired results. can anyone help.
1 answers

I suspect this is not working because you are not specifying a date in the time comparison. If you don't set it then it will use the current date, but your MainData/Timestamp may be using a different date.


You can change how to generate the comparison date by using the Timestamp, trimming this to just the date, and then using that date string along with the time to compare against.


For example, to get 6:30am on the same day as the timestamp.


parseDateTime(formatDateTime(trimToDays($MainData/Timestamp), 'yyyy-MM-dd') + ' 06:30:00', 'yyyy-MM-dd HH:mm:ss')


I hope this helps.