views:

46

answers:

2

Hi, 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?

+2  A: 

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.

Colin Pickard
No, it doesn't work.
Night Shade
+2  A: 

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.

Hugh Brackett
+1 for not using the date from the client machine.
Bernard