Focal Point
[SOLVED] Comparing time fields in a filter

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6277061086

January 07, 2016, 05:53 PM
Cimmerian
[SOLVED] Comparing time fields in a filter
I am trying to replicate this code:

WHERE FWLSTARTDATETIME GE DT(&TODAY 04:45:00);
WHERE FWLSTARTDATETIME LE DT(&TODAY 23:59:59);

But I can't figure out how to make a field that that pulls the current date but then assigns it a certain hour and minute.

Tried this in a define field but got an error:

This message has been edited. Last edited by: Cimmerian,


WebFocus 8.2, IA+, Windows 10, HTML
January 07, 2016, 06:00 PM
Waz
Use &YYMD and take out the colons.

The documentation tells you what DT supports


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 08, 2016, 12:11 PM
Cimmerian
Not quite sure I understand what you are telling me to do, sorry here's a screenshot:




WebFocus 8.2, IA+, Windows 10, HTML
January 09, 2016, 09:54 AM
George Patton
The documentation suggests the following format, although I shudder at the choice of 12:00:00AM as an example. All that shows is that the author is profoundly ignorant* of Latin and geography - and a slave to a bad convention.

WHERE TESTDT EQ DT(2009-02-06 12:00:00AM);

*AM stands for Ante Meridian and PM stands for Post Meridian. For a viewer on earth, the sun reaches it's zenith during the day at a time that corresponds to the actual meridian on the earth on which the viewer stands. We call that time noon - the point at which the sun crosses the meridian where we are.

Thus 12 hours Ante Meridian is the previous midnight. But 12 hours Post Meridian is ALSO midnight - the one coming up.

An alternative interpretation is that 12:00:00AM means 0 seconds before noon (if 11:59:59AM is one second before noon) and 12:00:00PM means zero seconds after noon (if 12:00:01 is one second after noon). Thus 12:00:00AM = 12:00:00PM. Nuts, no matter how you look at it.

So 11:59:59AM is defensible, and so is 12:00:01PM, but 12:00:00AM and 12:00:00PM ain't.

24-hour time, anyone?

But to solve your issue, you could do it in three four steps:

a) Create a variable that just captures the date, since that isn't a constant, then
b) Convert the date to alpha, (several methods), then
c) Concatenate the date with the static time, then
d) Use HCNVRT to convert the string to a Smart DateTime

Of course all this could be done on a single line with a bunch of brackets - I'll leave it up to the experts as to whether that's more efficient than separate defines (in my work I'm rarely concerned with performance issues, so I tend to be wordy and spell it out step by step).

.... Allow me a further digression on the origin of the word noon itself. This derives from the Christian liturgy in which a set of prayers called None(s) is said at the ninth hour after dawn. Monks in the middle ages ate breakfast before dawn and were not allowed to eat again until after Nones - that is until after the ninth hour. But the length of the hour was not constant between summer and winter, since it was the convention to have 12 hours from dawn to dusk. So monks in more northerly latitudes wouldn't get anything to eat from something like 5am to 6pm in summer, when they were out working in the fields etc. and needed nourishment. So a petition went to the pope, and a decree was issued that Nones could be said when the sun was at its zenith. Thus we have the word "noon" for the middle of the day ... Store that up for your next trivia game .....

This message has been edited. Last edited by: George Patton,


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
January 11, 2016, 01:49 PM
Cimmerian
Although it took me a second to find out that HCNVRT actually converts dates to alphanumerics and HINPUT converts alphas to dates you definitely pointed me in the right direction. I really appreciate it! Also all the additional information about time was both interesting and entertaining, thanks again! I will mark this thread to solved.


WebFocus 8.2, IA+, Windows 10, HTML
January 12, 2016, 06:39 AM
George Patton
Oops !! My bad.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP