1. radha rani
  2. PowerBuilder
  3. Tuesday, 5 June 2018 16:03 PM UTC

Hi,

I want to use the serverdate and time in my program,

Please suggest how to write the code,

I created the below fucntion for serverdate

datetime    ldt_server_datetime

********************************************************************
DECLARE my_cursor DYNAMIC CURSOR FOR SQLSA ;

PREPARE SQLSA FROM "SELECT GetDate() " ;

OPEN DYNAMIC my_cursor ;

FETCH my_cursor INTO :ldt_server_datetime ;

CLOSE my_cursor ;

return ldt_server_datetime

******************************************************************

How to use it in my application.

 

P.S : Creating an EXE no Datawindow and windows.

Accepted Answer
Kim Berghall Accepted Answer Pending Moderation
  1. Tuesday, 5 June 2018 18:11 PM UTC
  2. PowerBuilder
  3. # Permalink

You could also create a simple global function like: f_serverdate

datetime dt_now

SELECT getdate()
  INTO :dt_now
  FROM (SELECT a=1) t
 USING SQLCA;

Return dt_now

Comment
There are no comments made yet.
Matthew Balent Accepted Answer Pending Moderation
  1. Wednesday, 6 June 2018 11:50 AM UTC
  2. PowerBuilder
  3. # 1

If you are running on a Windows based network you should have the network time synchronized across all devices.  Generally the 'source of truth' for time being the primary domain controller.  That being said you don't need to query the database for dates/times as you can use the settings from the local machine.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.