File date/time formatting in rename dialog

Hi there,

I wanted to quickly add file date/time information to the file name with the rename dialog, I knew that there is support for using a date/time mask, but it seems it is only supported for the current date/time? Maybe mask support is something you can add for the file date/time stamps as well?

Thank you! o)

Quick demo, does not make much sense, but shows difference between {createddate} and {date}:
image

Prefix the mask with D#, if the type is datetime and you only want the date.

Prefix the mask which is not supported for {createddate}? o) Sorry, I don't get it.. o)

I want the created date as "yyyy_MM_dd" suffixed to the filename, so "yyyy_MM_dd_original-filename.png".

{createddate|D#yyyy_MM_dd} is what you want.

Thank you Leo, got it working.. I tried several variants after lxp's suggestion, but could not get it working.
Now it does, not sure what I did wrong at first, thank you both.

I looked up the "Codes for date and time" section in the docs, where "D#" and "T#" prefix is explained - now that I know of them. o) I must admit, this is unexpected to me, never had to deal with prefixes in date/time format strings. Without knowing any backgrounds, it does not make sense to me, since the placeholders in the mask seem to already make clear what part of a date/time string I want? Or put differently, whether only date or time information is present, should be of no importance to the mask and how it's supplied?

I hope I remember those prefixes in the future, I was about to write a script for that, but had a feeling that this task should be way easier - and it is! Thank you! o)

The prefixes are only needed for fields that combine date and time in one. Fundamentally it's because the Windows API has separate functions for formatting date and time strings.

Ah yes, interesting, there you have it, I'm not a windows programmer.. o)

You explanation sounds like it is not possible to have date and time information formatted at the same time? What if I need date and time from {modified}? Let me try.. o) Ok, it needs to look like this it seems..
{modified|D#yyyy-MM T#hh-ss}.

But if the prefix is only relevant to combined date/time things, wouldn't the prefix be obsolete if you just run both functions for a mask like "yyyy-MM hh:ss"?

Maybe one of the function does not like the placeholders known to the other? I could imagine things like that. If you don't know from the hip, never mind. It is not that important, I was just curious. o)

Exactly, you'd end up with junk from one format ending up in the other and vice versa.

I'm not really sure why the Windows API is the way it is, when they still went with M for months and m for minutes and made the codes case sensitive. I can never remember which need to be upper and lower, and it's a pain. But it's part of the OS, not our choice. We could do our own formatting but then we'd need yet another prefix to indicate you wanted that. :smiley:

1 Like

No, no more prefixes please.. o) Thank you for giving some insight, appreciated!

1 Like