I am having time in following format: 21 Dec 2017 03:52:42:000000
Which I need to convert to local time zone in xslt.
In my code I am using following format:
<xsl:param name="format" select="'h:mm:ss a'"/>
Which seems to incorrect, Please anyone correct my format.
If you want 21 Dec 2017 03:52:42:000000
format to for example something like 5:52:42
in local time and use xslt 1.0 there is no such way to directly format datetime value.
An xslt param is like a variable but it's value can be set from caller context, such as calling a template or given by xslt processor, so in your example value of $format
will be 'h:mm:ss a'
if it's not overriden from the caller. So basically this will be your output, not the formatted time.
Of course if you use an extension object with this predefined format string then formatting is the helper method's responsibility and it's not a question of xslt.
If you want to format datetime with native xslt 1.0 then here are some examples how to do it: see XSLT 1.0 stylesheet sample or in here there is sample for time splitting too. So time formatting is just cut out string parts.
for example your input <xsl:variable name="InputTime" select="'21 Dec 2017 03:52:42:000000'"/>
and
<xsl:value-of select="substring($InputTime, 13, 8)"/>
the output will be
03:52:42
If you slice it up as much as hours, minutes and seconds then you can modify them as numbers.