of_date


pfcapsrv.pbl   >   pfc_n_cst_conversion   >   of_date   

Full name pfc_n_cst_conversion.of_date
Access public
Extend of date
Return value date
Prototype public function date of_date(string)

Name Datatype
No Data

Name Datatype
ld_rc date
ll_count long
lnv_string n_cst_string
ls_datetime string[]

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

date	ld_rc = 1900-01-01
long	ll_count
string	ls_datetime[]
n_cst_string	lnv_string

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

// Validate datetime string ("1/1/95", "1/1/95 8:00", "1/1/95 8:00 PM")
ll_count = lnv_string.of_ParseToArray (as_datetime, " ", ls_datetime)
if ll_count <= 0 or ll_count > 3 then
	return ld_rc
end if

// Date string passed in
if ll_count = 1 then
	return Date (as_datetime)
end if

// Datetime string passed in
if ll_count = 2 or ll_count = 3 then
	return Date (ls_datetime[1])
end if

return ld_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.date systemfunctions
systemfunctions.isnull systemfunctions
systemfunctions.setnull systemfunctions
pfc_n_cst_string.of_parsetoarray pfc_n_cst_string

     
Full name
No Data

     
Name Scope
No Data