Hi Mario,
according to the IMatch help the formatting function "|format:XWOYM"
returns the Week of year as decimal number, with Monday as first day of week (01 – 54)
When I use this function like:
{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYM}
I get the week numbers without leading zeros. Is there a way to have the week with
leading zeros?
Best
Reinhard
Hi Reinhard... interestingly enough.. the following should work:
{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYM;numformat:int,02}
but at least on my system - it always returns just the year: 2016..!
The following does work though..
{File.DateTime|format:XWOYM;numformat:int,02}
Perhaps we found a bug? Check out my results from Vartoy:
{File.DateTime}
{File.DateTime|format:XWOYM;numformat:int,02}
.....
{File.MD.XMP::photoshop\DateCreated\DateCreated\0}
{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYM;numformat:int,02}
Results:
1/8/2016 5:19:59 PM
01
.....
1/8/2016 5:19:59 PM
2016
Another from later in the year:
6/2/2016 2:08:44 PM
22
.....
6/2/2016 2:08:44 PM
2016
Quote from: Reinhard on April 06, 2018, 10:16:05 AM
Hi Mario,
according to the IMatch help the formatting function "|format:XWOYM"
returns the Week of year as decimal number, with Monday as first day of week (01 – 54)
The documentation is wrong in this case, sorry. Or, at least, I should not have written it as 01 to 54 but a 1 to 54. I shall correct this.
The functions produce the week based on ISO8601, which does not include a leading zero. It does normally not make sense to number weeks like 01,02,03,...
In case you really need to number weeks with leading zeros, you can use the format provided by Jingo. Thanks.
Thanks a lot for such a quick answer and explanation. You are absolutely right, it normally not make sense. But some strange kind of sortings require leading zeros.
But as Jingo mentioned "numformat:int,02" unfortunately does not work with "File.MD.XMP::photoshop\DateCreated\DateCreated". It always returnes the year.
That's unfortunate. But you cannot combine a format and then a numformat on top of that. This confuses the variable parser and is not supported. Even IMatch has limits.
You should be successful with the numcomp function, though:
{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYS;numcomp:lt,10,0{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYS},{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:XWOYS}}
This compares the week number with 10. If it is less, it outputs "0" and the week number, else the week number.
But.. as my example shows... it works for the File.datetime using the same format and numformat.. so.. I'm confused! ;)
Things are never easy. And the variable parser is a very, very complicated beast.
I have no doubt things under the hood are complex... ;)
Combining a numformat with a format is just not supported (this is what you do in the case that fails in your example). Not all functions can be used in co-existence. I made some design decisions to weed out unlikely cases in favor of improved performance.
Thx for explaining... just seemed odd that both input values were the same.. but the export values were different.