Modify time in file date
I want to modify the time only in file Created Date, but I want to keep the date values and file name.
How can I do this?
How can I do this?
Reply to #1:
Hi Attila,
I'm not sure exactly what you mean, my friend. Do you mean you want to modify the files' Created Date timestamp, and if so what dates do you want to replace them with? If so, look at
https://www.advancedrenamer.com/user_guide/method_timestamp
You would click on "Apply to: Created Date and Time" to change that, but then you have to know where you are getting the new Created Date from.
If you mean you want to change a date that's in the files' names, you can do that with by using a Replace method to remove the date that's there now and replacing it with whatever you need (could be a tag, the current date/time, an arbitrary date, etc.). If it's a tag, look at
https://www.advancedrenamer.com/user_guide/tags_datetimecrea ted
Additionally, I'm not clear on what you mean by "keep the date values and file name".
If you want more specific help, we will need more specific details of the problem. We're here to help...
Best,
DF
Hi Attila,
I'm not sure exactly what you mean, my friend. Do you mean you want to modify the files' Created Date timestamp, and if so what dates do you want to replace them with? If so, look at
https://www.advancedrenamer.com/user_guide/method_timestamp
You would click on "Apply to: Created Date and Time" to change that, but then you have to know where you are getting the new Created Date from.
If you mean you want to change a date that's in the files' names, you can do that with by using a Replace method to remove the date that's there now and replacing it with whatever you need (could be a tag, the current date/time, an arbitrary date, etc.). If it's a tag, look at
https://www.advancedrenamer.com/user_guide/tags_datetimecrea ted
Additionally, I'm not clear on what you mean by "keep the date values and file name".
If you want more specific help, we will need more specific details of the problem. We're here to help...
Best,
DF
Reply to #1:
Welcome Attila!
I read your question differently than DF did.
I suppose your scenario is (A) you need to compensate for some clock offset or (B) you want to standardize file times.
Adjusting for incorrect clock example -- offset by an hour
You want {old name | timestamp} --> {new name | timestamp} :
Tiger Sighting 1 | 2024-07-28 19:38:47 --> Tiger Sighting 1 | 2024-07-28 18:38:47
Tiger Sighting 2 | 2024-08-03 04:46:11 --> Tiger Sighting 2 | 2024-08-03 03:46:11
Tiger Sighting 3 | 2024-08-11 05:03:20 --> Tiger Sighting 3 | 2024-08-11 04:03:20
etc.
Since this is trivial to do with a "Timestamp method" set to "Relative date and time", I'm guessing that's not it.
But see https://www.advancedrenamer.com/user_guide/method_timestamp if it is.
But if you want to falsify... Uh, I mean standardize... just the file time EG:
My Shift Start Log 1 | 2026-11-01 08:13:55 --> My Shift Start Log 1 | 2026-11-01 08:00:00
My Shift Start Log 2 | 2026-11-02 09:22:01 --> My Shift Start Log 2 | 2026-11-02 08:00:00
My Shift Start Log 3 | 2026-11-03 12:46:33 --> My Shift Start Log 3 | 2026-11-03 08:00:00
etc.
I don't see any way to do that except by using a "Script method".
See: https://www.advancedrenamer.com/user_guide/method_script
I'll post the script for that later, I've got to get some chores done now.
Regards,
Randy
Welcome Attila!
I read your question differently than DF did.
I suppose your scenario is (A) you need to compensate for some clock offset or (B) you want to standardize file times.
Adjusting for incorrect clock example -- offset by an hour
You want {old name | timestamp} --> {new name | timestamp} :
Tiger Sighting 1 | 2024-07-28 19:38:47 --> Tiger Sighting 1 | 2024-07-28 18:38:47
Tiger Sighting 2 | 2024-08-03 04:46:11 --> Tiger Sighting 2 | 2024-08-03 03:46:11
Tiger Sighting 3 | 2024-08-11 05:03:20 --> Tiger Sighting 3 | 2024-08-11 04:03:20
etc.
Since this is trivial to do with a "Timestamp method" set to "Relative date and time", I'm guessing that's not it.
But see https://www.advancedrenamer.com/user_guide/method_timestamp if it is.
But if you want to falsify... Uh, I mean standardize... just the file time EG:
My Shift Start Log 1 | 2026-11-01 08:13:55 --> My Shift Start Log 1 | 2026-11-01 08:00:00
My Shift Start Log 2 | 2026-11-02 09:22:01 --> My Shift Start Log 2 | 2026-11-02 08:00:00
My Shift Start Log 3 | 2026-11-03 12:46:33 --> My Shift Start Log 3 | 2026-11-03 08:00:00
etc.
I don't see any way to do that except by using a "Script method".
See: https://www.advancedrenamer.com/user_guide/method_script
I'll post the script for that later, I've got to get some chores done now.
Regards,
Randy
Reply to #3:
Hmmm... I can see now where that might be it. :)
Hmmm... I can see now where that might be it. :)
Reply to #4:
TBF, as you said, the question could be clearer.
Perhaps Attila really wants to reorder the timestamps so that the files are sorted correctly -- a common problem that has been addressed before a few times.
See: https://www.advancedrenamer.com/forum_thread/using-sequentia l-numbers-in-filenames-to-manipulate-created-date-and-time-1 6636
for example.
Anywho, this is how to set all the file times to the same value without touching the name or date:
1) Create a new script method ( https://www.advancedrenamer.com/user_guide/v4/method_script ).
2) Then paste the following code in the "function(index, item)" block and apply it.
*** Be sure to overwrite/replace anything that was in that input before. ***
//-------------------------------------------------------
// "function( index, item)" script
//-------------------------------------------------------
//--- Note that newTimeStr is a prime candidate for a project "Ask" variable. Hint, Hint.
const newTimeStr = "16:26:40"; //- HH:mm:ss, 24 hour format
//-- Matches strictly 00:00:00 through 23:59:59
const dcMatch = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.exec (newTimeStr);
if (!dcMatch) throw (`Invalid time format: "${newTimeStr}". Expected HH:MM:SS.`);
let newTimeStamp = new Date (item.createdDate);
const [hours, minutes, seconds] = newTimeStr.split (":").map (Number);
newTimeStamp.setHours (hours, minutes, seconds, 0);
item.newCreatedDate = newTimeStamp; // Updates the file
//-------------------------------------------------------
That code will change the all the files' created times to 4:26 PM. (Using the local timezone of your PC)
Adjust the value of newTimeStr to taste but keep it in the HH:mm:ss, 24 hour format.
If you also want to change the modified date, add this line of code:
item.newModifiedDate = newTimeStamp;
Regards,
Randy
TBF, as you said, the question could be clearer.
Perhaps Attila really wants to reorder the timestamps so that the files are sorted correctly -- a common problem that has been addressed before a few times.
See: https://www.advancedrenamer.com/forum_thread/using-sequentia l-numbers-in-filenames-to-manipulate-created-date-and-time-1 6636
for example.
Anywho, this is how to set all the file times to the same value without touching the name or date:
1) Create a new script method ( https://www.advancedrenamer.com/user_guide/v4/method_script ).
2) Then paste the following code in the "function(index, item)" block and apply it.
*** Be sure to overwrite/replace anything that was in that input before. ***
//-------------------------------------------------------
// "function( index, item)" script
//-------------------------------------------------------
//--- Note that newTimeStr is a prime candidate for a project "Ask" variable. Hint, Hint.
const newTimeStr = "16:26:40"; //- HH:mm:ss, 24 hour format
//-- Matches strictly 00:00:00 through 23:59:59
const dcMatch = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d$/.exec (newTimeStr);
if (!dcMatch) throw (`Invalid time format: "${newTimeStr}". Expected HH:MM:SS.`);
let newTimeStamp = new Date (item.createdDate);
const [hours, minutes, seconds] = newTimeStr.split (":").map (Number);
newTimeStamp.setHours (hours, minutes, seconds, 0);
item.newCreatedDate = newTimeStamp; // Updates the file
//-------------------------------------------------------
That code will change the all the files' created times to 4:26 PM. (Using the local timezone of your PC)
Adjust the value of newTimeStr to taste but keep it in the HH:mm:ss, 24 hour format.
If you also want to change the modified date, add this line of code:
item.newModifiedDate = newTimeStamp;
Regards,
Randy