I have a datawindow where I have a date field. I want to specify an initial value into that date field when a row is retrieved from the database. From the Column Specification, I want to set the initial date value of that field to current date. Is there any keyword or function which I can write in the Initial Value field?
1
votes
2 Answers
2
votes
today() should do it.
As Hugh says, you don't want to trust the client machine's clock for accurate time, but this is fine to initialize a data entry field to a sensible default.
6
votes
As a general rule, it's a bad idea to use the client's clock. It could be set to 1986 for all you know. Select the server's date in a hidden field and copy it to the table column. Another solution is to let the client put whatever it thinks the date/time is in the column (as in Colin's answer), then update it to server time in a post-insert trigger.