Page 1 of 1
Timestamp (scripting) error -- adds a day!
Posted: 23 Mar 2016 23:39
by avsfan
Hi,
I've got a script that I use to add version information to dll files, but I don't want the file date changed (which the relevant program does). So, in a foreach loop, I capture the modified date of the file, run the program on the file, and then run the timestamp script command to set the date back to the captured date.
However, when I do this, the date actually jumps forward a day (and it even happens if I do it in the address bar using ::timestamp , "3/23/2016 12:24:33 PM"; -- the time is correct, but the date is set to 3/24/2016 instead of 3/23/2016.
This appears to be a bug to me. Am I correct?
Thanks!
andy
Re: Timestamp (scripting) error -- adds a day!
Posted: 24 Mar 2016 13:05
by TheQwerty
Seems to be caused by the presence of 'PM'.
There's something extremely fishy going on here...
Code: Select all
timestamp , '3/23/2016 12:25:34 AM'; // Sets time to: '3/23/2016 12:25:34 PM'
timestamp , '3/23/2016 12:25:34 PM'; // Sets time to: '3/24/2016 12:25:34 PM'
timestamp , '3/23/2016 2:25:34 PM'; // Sets time to: '3/23/2016 2:25:34 PM'
timestamp , '3/23/2016 2:25:34 AM'; // Sets time to: '3/23/2016 2:25:34 AM'
My suggestion would be to use the ISO format when retrieving the date which should allow you to avoid this complication for the time being:
Re: Timestamp (scripting) error -- adds a day!
Posted: 24 Mar 2016 15:02
by avsfan
TheQwerty wrote:
My suggestion would be to use the ISO format when retrieving the date which should allow you to avoid this complication for the time being:
Thanks for the reply. Looks like I was able to do it using a block like this:
Code: Select all
foreach($file, "<get SelectedItemsPathNames |>") {
$tmpdate = property("#date.m",$file);
run """myCommandStringGoesHere""", ,2,0;
// timestamp , $tmpdate, $file; //old way -- didn't work
timestamp , formatdate ($tmpdate, "yyyy-mm-dd hh:nn:ss"), $file;
}
Still strange that the other (default) format didn't work...
Thanks again!
andy
Re: Timestamp (scripting) error -- adds a day!
Posted: 24 Mar 2016 15:08
by TheQwerty
Another option would be to retrieve the date in a different format by using
Report:
Code: Select all
$tmpdate = Report('{Modified yyyy-mm-dd hh:nn:ss}', $file);
avsfan wrote:Still strange that the other (default) format didn't work...
Indeed, this definitely looks like a bug.
Re: Timestamp (scripting) error -- adds a day!
Posted: 24 Mar 2016 15:17
by avsfan
TheQwerty wrote:Another option would be to retrieve the date in a different format by using
Report:
Code: Select all
$tmpdate = Report('{Modified yyyy-mm-dd hh:nn:ss}', $file);
Oh, cool -- I didn't know about that option! Thanks for letting me know!
Re: Timestamp (scripting) error -- adds a day!
Posted: 05 Apr 2016 20:08
by admin
Just to make sure:
12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34
right?
Re: Timestamp (scripting) error -- adds a day!
Posted: 05 Apr 2016 20:10
by TheQwerty
admin wrote:Just to make sure:
12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34
right?
Correct
Re: Timestamp (scripting) error -- adds a day!
Posted: 05 Apr 2016 20:27
by admin
Fix comes.