Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maximum date and time from multiple fields

Status
Not open for further replies.

wanxzhu

MIS
Jan 8, 2013
3
US
I have a problem to get the lates time from my table. Each ID has 4 start time in different columns, and some columns may be null. Here is a sample:
ID L1 L2 R1 R2
D001 10/10/2012 15:00 10/10/2012 15:15 10/10/2012 15:20 10/10/2012 15:50
D002 10/11/2012 09:01 10/11/2012 09:12
I would like my crystal report to pick the latest time in my report as D001 10/10/2012 15:50 and D002 10/11/2012 09:12
I appreciate if anyone has a solution for it.
 
Try using this formula in detail line

@Start
whileprintingrecords;

global datevar Start:= date(1900, 01,01);

If not(isnull(L1)) then start:= L1;

If not(isnull(L2)) and L2 > start then start:= L2;

If not(isnull(R1)) and R1 > start then start:= R1;

If not(isnull(R2)) and R2 > start then start:= R2;

Start;

Ian
 
Thanks Ian. It does show date. How to get date and time? I need to get the the difference between start time and end time whch I can get from the same formula.
 
Change the variable to datetime

global datetimevar Start:= date(1900, 01, 01, 0, 0, 0);

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top