apicito Posted January 28, 2014 Share Posted January 28, 2014 I have a question:When I use the "now" function get the server or client time? Link to comment Share on other sites More sharing options...
rencarnacion Posted January 28, 2014 Share Posted January 28, 2014 Of Course Server Time . In order to get the Client time you must use javaScript. 1 Link to comment Share on other sites More sharing options...
apicito Posted January 29, 2014 Author Share Posted January 29, 2014 Tkns. Link to comment Share on other sites More sharing options...
asapltda Posted April 7, 2014 Share Posted April 7, 2014 Tkns. Hello He could do it in unigui? could place the code Link to comment Share on other sites More sharing options...
vitisan Posted July 30, 2014 Share Posted July 30, 2014 hi , Anybody can help me solve this problem? thank for your kindness. Link to comment Share on other sites More sharing options...
Sherzod Posted July 30, 2014 Share Posted July 30, 2014 hi , Anybody can help me solve this problem? thank for your kindness. You want to know the server time on the client side? There are several ways, one of them: 1. Declare a variable. In MainForm.Scripts add the line: var uniGUIServerTime; 2. Now you can assign it a value: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";'); end; 3. Now on the client side you can use this variable Best regards. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 30, 2014 Administrators Share Posted July 30, 2014 hi , Anybody can help me solve this problem? What problem? Link to comment Share on other sites More sharing options...
vitisan Posted August 4, 2014 Share Posted August 4, 2014 You want to know the server time on the client side? yes, that right. There are several ways, one of them: Thank you very much. Link to comment Share on other sites More sharing options...
vitisan Posted August 5, 2014 Share Posted August 5, 2014 hi, delphi developer Thank you very much for your answer. i have some problem. step 1. In MainForm.Scripts add the line: var uniGUIServerTime; ok step 2. procedure TMainForm.UniFormCreate(Sender: TObject); begin UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";');end; ok step 3. use unit uniGUIApplication; step 4 . i make event onbuttonclick; procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin UniLabel1.Caption := UniSession.uniGUIServerTime; end; error message [dcc32 Error] Main.pas(40): E2003 Undeclared identifier: 'uniGUIServerTime' Thank you very much for your help. Link to comment Share on other sites More sharing options...
Sherzod Posted August 5, 2014 Share Posted August 5, 2014 Hi vitisan. var uniGUIServerTime; - It is not delphi variable, it is a variable javascript! You must use this:1. procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin UniLabel1.Caption := DateTimeToStr(Now); end; or 2. procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin UniSession.AddJS(UniLabel1.JSName + '.setText(uniGUIServerTime)'); end; or 3. procedure TMainForm.UniBitBtn1Click(Sender: TObject); begin UniSession.AddJS(UniLabel1.JSName + '.setText(' + DateTimeToStr(Now) + ')'); end; Best regards. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted August 5, 2014 Administrators Share Posted August 5, 2014 I have difficulty understanding the issue here. The answer to original question seems to be as easy as: UniLabel1.Caption := DateTimeToStr(Now); Link to comment Share on other sites More sharing options...
Sherzod Posted August 5, 2014 Share Posted August 5, 2014 You want to know the server time on the client side? There are several ways, one of them: 1. Declare a variable. In MainForm.Scripts add the line: var uniGUIServerTime; 2. Now you can assign it a value: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniSession.AddJS('uniGUIServerTime = "' + DateTimeToStr(Now) + '";'); end; 3. Now on the client side you can use this variable Best regards. I have difficulty understanding the issue here. The answer to original question seems to be as easy as: UniLabel1.Caption := DateTimeToStr(Now); I thought that the question was about the variable on the client side ... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now