apicito Posted January 28, 2014 Posted January 28, 2014 I have a question:When I use the "now" function get the server or client time? Quote
rencarnacion Posted January 28, 2014 Posted January 28, 2014 Of Course Server Time . In order to get the Client time you must use javaScript. 1 Quote
asapltda Posted April 7, 2014 Posted April 7, 2014 Tkns. Hello He could do it in unigui? could place the code Quote
vitisan Posted July 30, 2014 Posted July 30, 2014 hi , Anybody can help me solve this problem? thank for your kindness. Quote
Sherzod Posted July 30, 2014 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. Quote
Administrators Farshad Mohajeri Posted July 30, 2014 Administrators Posted July 30, 2014 hi , Anybody can help me solve this problem? What problem? Quote
vitisan Posted August 4, 2014 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. Quote
vitisan Posted August 5, 2014 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. Quote
Sherzod Posted August 5, 2014 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. Quote
Administrators Farshad Mohajeri Posted August 5, 2014 Administrators 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); Quote
Sherzod Posted August 5, 2014 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 ... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.