*copied from JS's ecco_pro yahoo forum post at
https://groups.yahoo.com/neo/groups/ecco_pro/conversations/topics/16516?reverse=
1 * Let’s assume you have a text folder EditTimeTxt, you may use the following rule to assign a current time to it: (it does not matter in which folder you put it, e.g. I keep all rules in Rules folder).
Code:++:L:
set_folder_value('EditTimeTxt', itemid, os.date('%Y%m%d %H%M %S', os.time()))
The above rule will change the time value each time you change the item. If you wish to keep an item creation time instead or in addition to a last edit time, you may use the following rule:
Code:++:L:
if get_folder_value('CreateTimeTxt', itemid) =='' then
set_folder_value('CreateTimeTxt', itemid, os.date('%Y%m%d%H%M %S', os.time()))
end
flag L means that the rule is a Lua script
os.time() -- without arguments returns the current system time
os.date() – converts time into string
'%Y%m%d%H%M %S' – stands for Year, month, day, hours, minutes, seconds
set_folder_value() -- does what its name says
itemid -- means current item
if value=='' then -- checks if the folder has no value and only then assign a value to the folder