Category:Indian film-related listsQ:
Formatting Unix timestamps in XSLT
I have a code that formats Unix timestamps as follows.
This code displays a time stamp in the following format
737203800000
I would like to print only the year and year month combination in the following format
201607
Is it possible to do this in XSLT?
A:
You can use the format instruction for that:
but the correct way is to use the XSLT 3.0 DateTime type (available since XSLT 3.0) to obtain a DateTime object from the timestamp (if the timestamp is really a timestamp). Then you can use date functions in XSLT 3.0 to convert it to the desired format.
See also
A:
You could add
and then
This will result in
201607
If you want
201607
you would have to add a second substring, but then it would be
201607
instead of
201607
201607
If you want to have a leading 0 you would have to add
and then ac619d1d87
Related links:
Comments