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
Timestamp (scripting) error -- adds a day!
Re: Timestamp (scripting) error -- adds a day!
Seems to be caused by the presence of 'PM'.
There's something extremely fishy going on here...
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:
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'
Code: Select all
yyyy-mm-dd hh:nn:ss.fffffff
Re: Timestamp (scripting) error -- adds a day!
Thanks for the reply. Looks like I was able to do it using a block like this: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:Code: Select all
yyyy-mm-dd hh:nn:ss.fffffff
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;
}
Thanks again!
andy
Re: Timestamp (scripting) error -- adds a day!
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);
Indeed, this definitely looks like a bug.avsfan wrote:Still strange that the other (default) format didn't work...
Re: Timestamp (scripting) error -- adds a day!
Oh, cool -- I didn't know about that option! Thanks for letting me know!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);
-
- Site Admin
- Posts: 60538
- Joined: 22 May 2004 16:48
- Location: Win8.1 @100%, Win10 @100%
- Contact:
Re: Timestamp (scripting) error -- adds a day!
Just to make sure:
12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34
right?
12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34
right?
FAQ | XY News RSS | XY Twitter
Re: Timestamp (scripting) error -- adds a day!
Correctadmin wrote:Just to make sure:
12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34
right?