Timestamp (scripting) error -- adds a day!

Things you’d like to miss in the future...
Post Reply
avsfan
Posts: 554
Joined: 29 Jun 2006 09:00
Location: Fort Collins, Colorado

Timestamp (scripting) error -- adds a day!

Post 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

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Timestamp (scripting) error -- adds a day!

Post 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:

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!

Post 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:

Code: Select all

yyyy-mm-dd hh:nn:ss.fffffff
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

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Timestamp (scripting) error -- adds a day!

Post 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.

avsfan
Posts: 554
Joined: 29 Jun 2006 09:00
Location: Fort Collins, Colorado

Re: Timestamp (scripting) error -- adds a day!

Post 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!

admin
Site Admin
Posts: 60602
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Timestamp (scripting) error -- adds a day!

Post by admin »

Just to make sure:

12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34

right?

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Timestamp (scripting) error -- adds a day!

Post by TheQwerty »

admin wrote:Just to make sure:

12:25:34 AM = 00:25:34
12:25:34 PM = 12:25:34

right?
Correct

admin
Site Admin
Posts: 60602
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Timestamp (scripting) error -- adds a day!

Post by admin »

Fix comes.

Post Reply