IBI WebFOCUS - Finding Run Time Stamp in A.M./P.M. format

Almost all reports (including WebFOCUS) usually need to show Report Run Date and Time. WebFOCUS provides us the variables &DATE and &TOD(system variables) to get system date and time and use it in our report without calculating anything in the procedure.

However in some of the report we need to show time stamp in a.m./p.m. format. I have created the logic and I feel that sharing it might save some hours of development time for developers looking for such requirement. Below is the piece of code you can put in your procedure and you can use &TOD2 in your report header.


-SET &M='';
-SET &H1 = EDIT(&TOD,'99');
-SET &H2 = IF &H1 GT 12 THEN &H1 - 12 ELSE &H1;
-SET &M = IF &H1 GT 12 THEN ' PM' ELSE ' AM';
-SET &TOD2 = &H2 | EDIT(&TOD,'$$$:99$') | EDIT(&TOD,'$$$:$$$99') | &M;

-TYPE &TOD
-TYPE &TOD2

Please share your thoughts/ feedback's. 
Happy coding in WebFOCUS!!!!

Comments

Popular posts from this blog

IBI WebFOCUS - Functions available and syntax to use

IBI WebFOCUS - Difference (Preference) between Join and Match:

IBI WebFOCUS - Testing and Debugging in WebFOCUS codes