Time stamp supporting UNIX Time

Advanced Renamer forum
#1 : 23/06-22 16:00
AdNvko
AdNvko
Posts: 1
Hi there. Advanced Renamer is really a great job. But I've noticed that there were few apps that using unix time instead of regular date in filename. So would you mind to add unix time support in time stamp function? Thanks a lot.


23/06-22 16:00
#2 : 24/06-22 17:39
David Lee
David Lee
Posts: 1125
It is straightforward to convert UNIX timestamps using a script method. The details will depend upon whether the epoch is in decimal or hex and seconds or milliseconds but if we assume decimal seconds the following script will convert eg "1656090525.txt" to "2022-06-24_17-08-08.txt"

epoch = item.name * 1000;
dat = new Date(epoch);
return dat.getUTCFullYear().toString()
+ "-" + ("0" + (dat.getUTCMonth() + 1)).slice(-2)
+ "-" + ("0" + dat.getUTCDate()).slice(-2)
+ "_" + ("0" + dat.getUTCHours()).slice(-2)
+ "-" + ("0" + dat.getUTCMinutes()).slice(-2)
+ "-" + ("0" + dat.getUTCMinutes()).slice(-2);


24/06-22 17:39 - edited 24/06-22 18:19