How to write code to get the todays date at 00:00 hour in epl

Explanation
If current date and time: 08-12-2023 14:33:00
I want 08-12-2023 00:00:00 as fromDate and 08:12:2023 14:33:00 as toDate
to get the measurement between the time period.
How can I achieve this?

You can obtain the current time from the currentTime variable. However, see Getting the current time, as you may wish to use TimeFormat.getSystemTime() instead.

The safest way to obtain the fromDate in your case would be to format the current time using just the date so the time of day is lost.
float fromDate := TimeFormat.parseTime("yyyy-MM-dd", TimeFormat.format(currentTime, "yyyy-MM-dd"));
See TimeFormat (apama.com). If you wish to find midnight in UTC use the parseTimeUTC() and formatUTC functions. If you intend to perform this calculation frequently in your code, consider creating a CompiledPattern object.

See Querying for measurements (softwareag.com) for how to search for measurements between a from date and to date.

1 Like