Janusz's solution is better - I would probably do it through the default setting of the field in the database as well but implementing a field that is updated with the date everytime it is edited was my first step into understanding how Nubuilder worked..
Here's some Javascript that can be used widely to update a field to show when a record was updated. It could be adapted to include the time...
To be placed
Forms / Form of choice / Custom Code / Javascript
Code: Select all
function GetTodayDate() {
var tdate = new Date();
var dd = tdate.getDate(); //yields day
var MM = tdate.getMonth(); //yields month
var yyyy = tdate.getFullYear(); //yields year
var currdate = dd + "-" + MM + "-" + yyyy;
return currdate;
}
Function to update field called “DateUpdated” on edit- to be used with the GetTodayDate() function
Code: Select all
function nuOnSave() {
if (nuFORM.edited == true)
{
$( "#DateUpdated" ).val( GetTodayDate() );
}
return true;
}
and from Stack overflow here is a Javascipt version that does time = its useful to compare the function that I have and the function listed on stack overflow.
Code: Select all
function timeNow(i) {
var d = new Date(),
h = (d.getHours()<10?'0':'') + d.getHours(),
m = (d.getMinutes()<10?'0':'') + d.getMinutes();
i.value = h + ':' + m;
}