Home > database >  Take the server time's function
Take the server time's function

Time:09-24

Dw_1. Object. ZBRQ. Text=string (gf_server_date (), "yy. Mm. Dd") date of this statement from the server, how to collect the server time

CodePudding user response:

Gf_server_date () - a custom function

CodePudding user response:

Yes, but I can't find where is the definition?

CodePudding user response:

Browser - & gt; function

CodePudding user response:

Ha ha, rookie also many,

CodePudding user response:

If your global function gf_server_date () returns the Datetime type:
String (gf_server_date (), "hh: mm: ss")//returns the character type time
String (gf_server_date (), "yyyy. Mm. Dd hh: mm: ss")//returns the character type date/time

CodePudding user response:

If is the oracle database, you can write (sqlca has connected) :
F_set_errinfo () is another custom functions, used to store the current error message

/*
Function:
Gets the time
Parameters:
There is no
The return value:
Successful return to time; Error returns an empty
*/
Datetime ldt_now

SetNull (ldt_now)
The select sysdate into: ldt_now from dual;
If the sqlca. Sqlcode=1 then f_set_ErrInfo (this, "f_get_servertime () ~ t" + sqlca. Sqlerrtext)

Return ldt_now

CodePudding user response:

As said, on the second floor gf_server_date () is a custom function, get inside the function to find the

If the oracle database, so to write, SELECT SysDate INTO: ldt_today FROM Dual;
Ls_today=String (ldt_today, 'yy. Mm. Dd)

CodePudding user response:

Leave a name

CodePudding user response:

Don't bother!!!!!
St_3. Text=string (Today (), "yyyy - mm - dd hh: mm: ss")

CodePudding user response:

[PbObjFind]


After integration on the menu to pb, restart pb, pb in the toolbar to open the can after,

Gf_server_date on object input, query, points to open the object (or double-click the data window object), you can in pb opened the object inside the

Download address:

http://download.csdn.net/source/871087

CodePudding user response:

* function description: get the server's date/time (DateTime)
Meaning: * parameter as_dbms database used by the DBMS
* return back value: datetime types, system date
* call, for example: ldt_today=gf_getsysdate (sqlca. DBMS)
* writers: Guo Baoli
* write date: 2004.7.9
* -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - */
Datetime ldt_date
String ls_sql

Choose a case the lower (as_dbms)
Case "oracle"
//oracle
Ls_sql="select sysdate from sys. Dual"
Case "is essentially"
//ms SQL server
Ls_sql="select now ()"
Case "sybase
"//sybase
Ls_sql="select getdate ()", "
In case the else
Ls_sql="select now ()"
The end choose
Declare l_cursor dynamic cursor for Sqlsa;
Prepare Sqlsa from: ls_sql;
The Open dynamic l_cursor;
If the Sqlca. SQLCode=0 then
The Fetch l_cursor into: ldt_date;
End the if
If the sqlca. SQLCode & lt;> 0 then
Messagebox (" error ", "in function gf_get_sysdate () run-time database error!" )
Ldt_date=Datetime (Today (), Now ())
End the if
The Close l_cursor;

Return ldt_date


I turned, I hope for your help

CodePudding user response:

Upstairs positive solution

CodePudding user response:

Global function o miserable

CodePudding user response:

I am doing an oracle dedicated system time function
Datetime ld_sysdate
The select sysdate into: ld_sysdate from dual;
Return ld_sysdate

CodePudding user response:

Agree with the upstairs

CodePudding user response:

Gf_server_date () for a custom global function, in SQL SERVER, the PB method for:
DATETIME ldt_DT
SELECT the TOP 1 GETDATE () INTO: ldt_DT FROM SYSOBJECTS;

RETURN ldt_DT

CodePudding user response:

January is not knot stick
Remember the FROM SYSOBJECTS or FROM dual
Grab a record less little table to use

The SELECT GETDATE () FROM t1;

The SELECT GETDATE ()

CodePudding user response:

Datetime ldt_datetime
The select curdatetime into: ldt_datetime
The from (select getdate () as curdatetime) cur_dt
;

This is more efficient ~ ~

CodePudding user response:

Can be

CodePudding user response:

The
references to the tenth floor liubocy response:
[PbObjFind]


After integration on the menu to pb, restart pb, pb in the toolbar to open the can after,

Gf_server_date on object input, query, points to open the object (or double-click the data window object), you can in pb opened the object inside the

Download address:

http://download.csdn.net/source/871087


Very want to use, but not PB12.5, want to recompile error, can use the high version of the next pass,
  • Related