There are a couple of points to consider in your situation:
1. If you just want the local machine date, you could use the Today() function embeding it within the String() function for the right format. This would be fine for most reports.
2. If you are inserting data into a database, you would do well to get the Server-Date from your database and then populate the value. You could write a Global function to do this so it could be re-used. Following is the code for Oracle database:
///////////////////////////////////////////////////////////////
FUNCTION integer f_Today( REF dateTime ldt_Today )
///////////////////////////////////////////////////////////////
// The System-date value is passed by reference here
///////////////////////////////////////////////////////////////
uLong lul_Handle ;
////////////////////
//
SetNull( ldt_Today ) ; // Init!
//
// Check for Database connection
lul_Handle = SQLCA.DBHandle() ;
//
IF IsNull( lul_Handle ) OR lul_Handle <= 0 THEN
RETURN -1 ; // Failure
END IF ;
//
SELECT SysDate
INTO :ldt_Today
FROM DUAL
USING SQLCA ;
//
IF SQLCA.SQLCode <> 0 THEN
SetNull( ldt_Today ) ; // Init!
END IF ;
//
RETURN 1 ; // Success
I missed a line of code (RETURN -1) at the end inadvertently. Here is the corrected script for the function:
///////////////////////////////////////////////////////////////
FUNCTION integer f_Today( REF dateTime ldt_Today )
///////////////////////////////////////////////////////////////
// The System-date value is passed by reference here
///////////////////////////////////////////////////////////////
uLong lul_Handle ;
///////////////////////
//
SetNull( ldt_Today ) ; // Init!
//
// Check for Database connection
lul_Handle = SQLCA.DBHandle() ;
//
IF IsNull( lul_Handle ) OR lul_Handle <= 0 THEN
RETURN -1 ; // Failure
END IF ;
//
SELECT SysDate
INTO :ldt_Today
FROM DUAL
USING SQLCA ;
//
IF SQLCA.SQLCode <> 0 THEN
SetNull( ldt_Today ) ; // Init!
RETURN -1 ;
END IF ;
//
RETURN 1 ; // Success
thanks for your help. I didn't get to check the response for the past few days.
I wanted to know if you can guide me on if I wanted to set the date from a GUI, how would I do that? For example, I have made a GUI with a GroupBox control named "Select a time period" In the groupbox there are RadioButtons This week, last week , and specify a date where This week represents the last day of the current week. Last week represents the last day of last week and Specify Date allows the person to specify the date. If I speciy the date, I have to go to a table and find the specified date from the table.However, this table has the values in Julian Date format.
I hope what I am asking is clear. I'd appreciate your help.
Do you know how to do the conversions in Powerbuilder using Sybase Central as the database? If not do you know of any other forums for powerbuilder and sybase central?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.