of_secondsafter


pfcapsrv.pbl   >   pfc_n_cst_datetime   >   of_secondsafter   

Full name pfc_n_cst_datetime.of_secondsafter
Access public
Extend of long
Return value long
Prototype public function long of_secondsafter(datetime,datetime)

Name Datatype
No Data

Name Datatype
ld_edate date
ld_sdate date
ll_day_adjust long
ll_null long
ll_total_seconds long
lt_etime time
lt_stime time

public function long of_secondsafter (datetime adtm_start, datetime adtm_end);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  		of_SecondsAfter
//
//	Access:  		public
//
//	Arguments:
//	adtm_start 		Beginning time.
//	adtm_end   		Ending time.
//
//	Returns:  		long
//						Number of whole seconds between two date times.
//						If any argument's value is NULL, function returns NULL.
//						If any argument's value is Invalid, function returns NULL.
//
//	Description:  	Given two datetimes, return the number of seconds between 
//						the two.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
//	Copyright © 1996-1997 Sybase, Inc. and its subsidiaries.  All rights reserved.
//	Any distribution of the PowerBuilder Foundation Classes (PFC)
//	source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////

long ll_total_seconds, ll_day_adjust
date ld_sdate, ld_edate
time lt_stime, lt_etime

//Check parameters
If IsNull(adtm_start) or IsNull(adtm_end) or &
	Not of_IsValid(adtm_start) or Not of_IsValid(adtm_end) Then
	long ll_null
	SetNull(ll_null)
	Return ll_null
End If

ld_sdate = date(adtm_start)
ld_edate = date(adtm_end)

lt_stime = time(adtm_start)
lt_etime = time(adtm_end)

//Note: 86400 is number of seconds in a day.
If ld_sdate = ld_edate then 
	ll_total_seconds = secondsafter(	lt_stime,lt_etime)
Elseif ld_sdate < ld_edate Then
	ll_total_seconds = SecondsAfter(lt_stime,Time('23:59:59'))
	ll_day_adjust = DaysAfter(ld_sdate,ld_edate) -1
	If ll_day_adjust > 0 Then ll_total_seconds = ll_total_seconds + 86400 * ll_day_adjust
	ll_total_seconds = ll_total_seconds + SecondsAfter(Time('00:00:00'),lt_etime) +1
Else //end date < start date
	ll_total_seconds = SecondsAfter(lt_stime,Time('00:00:00'))
	ll_day_adjust = DaysAfter(ld_sdate,ld_edate) +1
	If ll_day_adjust < 0 Then ll_total_seconds = ll_total_seconds + 86400 * ll_day_adjust
	ll_total_seconds = ll_total_seconds + SecondsAfter(Time('23:59:59'),lt_etime) -1
end If

return ll_total_seconds

end function

     
Name Owner
No Data

     
Name Owner
systemfunctions.date systemfunctions
systemfunctions.daysafter systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.secondsafter systemfunctions
systemfunctions.setnull systemfunctions
systemfunctions.time systemfunctions
pfc_n_cst_datetime.of_isvalid pfc_n_cst_datetime

     
Full name
No Data

     
Name Scope
No Data