Page 1 of 1

how to get system date in jade

Posted: Wed Nov 04, 2009 7:02 pm
by mario
hi guys,
I got a text box called txtDate on my form and I want it to display current system date everytime i run the form.
How is it possible?

cheers, mario :)

Re: how to get system date in jade

Posted: Wed Nov 04, 2009 9:29 pm
by murray
What part of that are you having trouble with? The "actualTime...." methods on the Application class may help. It is in the EncycloSys1.pdf manual. The Time and Date 'format' methods may also be useful.
Another way to approach it could be to utilise the 'formatOut' property of a TextBox or Label (in EncycloWin.pdf).

Re: how to get system date in jade

Posted: Thu Nov 05, 2009 2:28 am
by ghosttie
Date variables are initialized to the current date, so you'd just have to do something like this:

Code: Select all

vars d : Date; begin txtDate.text := d.format(app.currentLocaleInfo.dateInfo.shortFormat); end;

Re: how to get system date in jade

Posted: Thu Nov 05, 2009 7:49 am
by BeeJay
You can also simplify your code further by using a JadeEditMask instead of a TextBox control for the field that will display the date. Then, to set the the JadeEditMask::text property in a locale aware format you can use the JadeEditMask::setTextFromDate( <date> ) method. The following code snippet is an example of setting the JadeEditMask::text property to the current date as viewed by the machine hosting the DbServer.

Code: Select all

jemDate.setTextFromDate( app.actualTimeServer.date );
You may want to read up on the JadeEditMask's other setTextFromXXXX methods, and also their "partner" getTextAsXXXX methods, for dealing with Dates, Decimals, Integers, Reals, and Times.

Cheers,
BeeJay.