Ender Posted June 6, 2006 Share Posted June 6, 2006 On my xsl web page I have a portal with a time field, but the time is formatted in 24 hour format. How do I get it to display in 12 hour format? I know there are time formatting functions, but it's not clear how to apply them (this XML/XSL stuff is new to me.) This is the code: [b][/b] The 'eventdates::Time_Start' field is the one that needs formatting. Link to comment Share on other sites More sharing options...
Martin Brändle Posted June 6, 2006 Share Posted June 6, 2006 You can use the fmxslt:convert_datetime(String oldFormat, String newFormat, String date) function for that. If you want to count the hours 1-12 instead 0-11, use 'h:mm:ss a' instead of 'K:mm:ss a' . BTW, in your code, you were comparing two literal values, 'eventdates::Time_Start' != '0:00:00', which of course is always true. Just don't put the field name in apostrophes. I had used a variable instead, because the field is used twice (in the xsl:when and in the xsl:value-of) Link to comment Share on other sites More sharing options...
Ender Posted June 6, 2006 Author Share Posted June 6, 2006 That did the trick. Thanks so much! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6534 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now