The eccoMAGIC Forums
http://forums.eccoMAGIC.com/forum/YaBB.pl
the SLANG EXTENSION and Guest Programming >> Slang Rules Scripts, Functions, Examples and HOW TO >> How to add FINE DETAIL TIME STAMP as text folder entry
http://forums.eccoMAGIC.com/forum/YaBB.pl?num=1472118759

Message started by Admin on 08/25/16 at 04:52:39

Title: How to add FINE DETAIL TIME STAMP as text folder entry
Post by Admin on 08/25/16 at 04:52:39



*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



The eccoMAGIC Forums » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.