Ajouter heures de decalage à une photo - Time Zone

Advanced Renamer forum
#1 : 19/07-18 19:14
AUCLERT
AUCLERT
Posts: 2
Bonjour,
Brian Hanton 02/02/18 à poster une méthode pour décaler ou avancer - les horaires -
Ci-joint:

var str = item.name;
var deltaHrs = -1;
var deltaMs = deltaHrs * 60 * 60 * 1000 /* Hrs to min to sec to ms */
var fixmnth = -1;
var Sccyy = str.substr(0,4);
var Smm = str.substr(4,2);
var Sdd = str.substr(6,2);
var Shh = str.substr(9,2);
var Snn = str.substr(11,2);
var Sss = str.substr(13,2);

var inStamp = new Date(Date.UTC(Sccyy,Smm,Sdd,Shh,Snn,Sss,0));
inStamp.setMonth(inStamp.getMonth() + fixmnth); /* Curse JS 0-11 Months */

var isoNew = new Date(inStamp.getTime() + (deltaMs)).toISOString();

var Fccyy = isoNew.substr(0,4);
var Fmm = isoNew.substr(5,2);
var Fdd = isoNew.substr(8,2);
var Fhh = isoNew.substr(11,2);
var Fnn = isoNew.substr(14,2);
var Fss = isoNew.substr(17,2);

var newName = Fccyy + Fmm + Fdd + "_" + Fhh + Fnn + Fss;

return newName;

Malheureusement je tombe en erreur

- Script invalide: lino 0 _itemFunc is not defined

Merci pour votre retour

Alain


19/07-18 19:14
#2 : 19/07-18 19:44
Domi
Domi
Posts: 27
Reply to #1:
Next time in English please. :-)

The script works fine for me, maybe you copied something wrong???
Or is the date/time wrong (missing 0)? Pls give filenames you are working with.
Even nonsense like 20180230_256150 worked for me. :)

----------

In special cases you may contact me on Discord: http://bit.ly/dsDisco


19/07-18 19:44
#3 : 22/07-18 19:45
AUCLERT
AUCLERT
Posts: 2
Reply to #2:
Bonjour
Merci pour votre réponse
il y a un décalage de + 6 avec Beijing (Pekin) Chines
Ci-joint fichier joint:
20180531_015556_Chine_IMG_6249
Erreur : Script invalide: line 0: _itemFunc is not defined
I made a copy paste into the script as proposed
I only changed the hours

var str = item.name;
var deltaHrs = +6;
var deltaMs = deltaHrs * 60 * 60 * 1000 /* Hrs to min to sec to ms */
var fixmnth = +6;
var Sccyy = str.substr(0,4);
var Smm = str.substr(4,2);
var Sdd = str.substr(6,2);
var Shh = str.substr(9,2);
var Snn = str.substr(11,2);
var Sss = str.substr(13,2);

var inStamp = new Date(Date.UTC(Sccyy,Smm,Sdd,Shh,Snn,Sss,0));
inStamp.setMonth(inStamp.getMonth() + fixmnth); /* Curse JS 0-11 Months */

var isoNew = new Date(inStamp.getTime() + (deltaMs)).toISOString();

var Fccyy = isoNew.substr(0,4);
var Fmm = isoNew.substr(5,2);
var Fdd = isoNew.substr(8,2);
var Fhh = isoNew.substr(11,2);
var Fnn = isoNew.substr(14,2);
var Fss = isoNew.substr(17,2);

var newName = Fccyy + Fmm + Fdd + "_" + Fhh + Fnn + Fss;

return Item newName

return item.newBasename

Merci de votre collaboration
Cordialement
Alain


22/07-18 19:45