Subject:Date formating Author:David Martin Date:15 Nov 2005 12:58 PM
I'm new to date formating from within style sheets using xslt....but aging quickly.
How do I use and test ms:format-date from within Stylus 6?
It is not clear to me how Stylus supports testing the date-format spec exactly...and so I'm looking for a working set of date formating examples for testing within Stylus studio using MSXML 4 and preferrably MSXML 6. Since I'm using .NET ms:format-date seems to be what I want...however I would I'm not sure if that necessitates marking up my raw xml data.
Subject:Date formating Author:David Martin Date:15 Nov 2005 10:12 PM
ms:format-date does the trick and was all I wanted to use...just some "simple" date formating.
But I never managed to get it working for some reason using the studio (and still can't) - I may have mucked something up in my environment with various betas I was evaluating.
Subject:Date formating Author:(Deleted User) Date:16 Nov 2005 09:17 AM
Dave,
Your original .xslt file had a couple of small errors.
Try the one I attached in my earlier post. Also, as Ivan suggested, make sure your processor is set to MSXML 4 (in the scenario processor tab).
Subject:Date formating Author:(Deleted User) Date:23 Nov 2005 12:53 PM
GG,
The original date presented as an example in this thread was:
2005-11-15T10:01:00.0000000-04:00
If you convert that using the ms:format-date function,
You get the equivalent UTC, namely 2:01 PM.
If you use substring() to strip off the "-4:00" at the end before
calling ms:format-date, you will get the local time, 10:01 AM.
Subject:Date formating Author:GG Krish Date:23 Nov 2005 12:57 PM
We DO NOT have the timezone portion in the timestamp info we get. It is simply a GMT timestamp. We need to add the timezone info based on the local time.
Subject:Date formating Author:(Deleted User) Date:23 Nov 2005 01:11 PM
GG,
I don't know which timezone you are in, but suppose you are in EST like me. Then concatenate "+0400" to the end of the time stamp and do the conversion. I think you will get what you want.
Subject:Date formating Author:(Deleted User) Date:23 Nov 2005 02:30 PM
So, if I understand correctly, you are getting a GMT time stamp from somewhere, and you want to convert it to the local time.
I need to understand your environment. Are you working with David (the person who started this thread?) If you are, then I assume you want to use the Microsoft date-time functions ms:....
If not, then what is your environment, what is your date format, and what functions are you using to manipulate them?
Thanks
Clyde
P.S. You are posting the same reply 2 or 3 times to the bulletin board.
Subject:Date formating Author:(Deleted User) Date:23 Nov 2005 04:38 PM
This is what I understand:
You get time stamps which look like this:
2005-11-15T10:01:00.0000000
without any time zone info. You are interpreting them as times in UTC, and want to convert them to the local time zone for display. You (or I) can write a Java extension function which gets the local time zone, and concatenate that (with a suitable + or -) and then use the ms:format-date and ms:format-time functions to do the time-zone offset.
One problem with this is that it will probably give the wrong answer right around the time that daylight savings goes on/off.
Subject:Date formating Author:David Martin Date:25 Nov 2005 08:47 AM
Sorry for delay in responding and thanks for tips. ms:format-date and ms:format-time was exactly what I was trying to use all along. After my initial post and review of responses, I went back and tried calling the exact same routines again in my code, as is, and all worked fine (I had just mocked up a snippet for the post). It appears like I must have had some other issue at the time I was trying to initially implement the function call...and that sent me on quite a bit of a chase prior to posting actually.
Unfortunately, I changed several things along the way just prior to posting and so now to actually roll back to what my initial issue was...java jdk, eval studio (4->6), xslt processor (saxon 8.6x), restructured and linked xsl templates, .net (beta to release)...so I can not shed any light on what my original problem actually was (and we won't speculate on that one any further) but the likely issue was just a style sheet template usage mistake by me...eh hem, hem.
So I can now at least enjoy the satisfaction that xsl date formating works fine with the ms:format-date and ms:format-time calls as previous members have pointed out.
I did also hit the fact that ms:format-time applies the sql server gmt offset when formating the time. As previous posts point out the gmt can be appended (or modified)...if missing.