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!
Forum rules
You might want to read this if you're looking for priority service
Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
You might want to read this if you're looking for priority service
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
-
avsfan
- Posts: 554
- Joined: 29 Jun 2006 09:00
- Location: Fort Collins, Colorado
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
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-
avsfan
- Posts: 554
- Joined: 29 Jun 2006 09:00
- Location: Fort Collins, Colorado
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
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
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...
-
avsfan
- Posts: 554
- Joined: 29 Jun 2006 09:00
- Location: Fort Collins, Colorado
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);
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @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 X
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
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?
-
admin
- Site Admin
- Posts: 67271
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
XYplorer Beta Club