of_time


pfcapsrv.pbl   >   pfc_n_cst_conversion   >   of_time   

Full name pfc_n_cst_conversion.of_time
Access public
Extend of time
Return value time
Prototype public function time of_time(string)

Name Datatype
No Data

Name Datatype
ll_count long
lnv_string n_cst_string
ls_datetime string[]
ltm_rc time

public function time of_time (string as_datetime);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_Time
//
//	Access:  public
//
//	Arguments:
//	as_datetime   Datetime value as a string
//
//	Returns:  time
//	If as_datetime does not contain a valid datetime value, return time
//	is 00:00:00.000000.  If as_datetime is NULL, function returns NULL.
//
//	Description:
//	Converts a string whose value is a valid datetime to a time value
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0.02   Initial version
// 5.0.04 	Enhanced to handle more cases.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

time	ltm_rc = 00:00:00.000000
long	ll_count
string	ls_datetime[]
n_cst_string	lnv_string

// Check arguments
if IsNull (as_datetime) then
	SetNull (ltm_rc)
	return ltm_rc
end if

// Validate datetime string
ll_count = lnv_string.of_ParseToArray (as_datetime, " ", ls_datetime)
if ll_count <= 0 or ll_count > 3 then
	return ltm_rc
end if

// Date string passed in ("8:00pm")
if ll_count = 1 then
	return Time (as_datetime)
end if

// Datetime string passed in ("1/1/95 8:00pm")
if ll_count = 2 then
	return Time (ls_datetime[2])
end if

// Datetime string passed in ("1/1/95 8:00 pm")
if ll_count = 3 then
	return Time (ls_datetime[2]+' '+ls_datetime[3])
end if

return ltm_rc
end function

     
Name Owner
pfc_n_cst_dwsrv.of_setitem pfc_n_cst_dwsrv
pfc_n_cst_dssrv.of_setitem pfc_n_cst_dssrv

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.setnull systemfunctions
systemfunctions.time systemfunctions
pfc_n_cst_string.of_parsetoarray pfc_n_cst_string

     
Full name
No Data

     
Name Scope
No Data