Gossamer Forum
Home : Products : DBMan SQL : Discussion :

storing date added / date modified

Quote Reply
storing date added / date modified
using dbman sql 2, with default templates,

is it possible to set 2 fields,
one which stores date record was added
one which stores date record was last updated.

I have played around with timestamp fields in mysql, but have not managed to get this to work.

Any help much appreciated.
Tim Ault
Oxford UK
Quote Reply
Re: [timbo] storing date added / date modified In reply to
In this case, you can create global template to accomplish this matter:

sub {
require GT::Date;
return GT::Date::date_get(time, "%mm%-%dd%-%yyyy% %hh%:%MM%:%ss%");
}

Now, you need to add those hidden objects below into:

- add_form:

<input type="hidden" name="added_date" value="<%global_name%">
<input type="hidden" name="updated_date" value="<%global_name%">

- modify_form:
<input type="hidden" name="updated_date" value="<%global_name%">

Hope that helps,

TheStone.

B.