Taking a look at here: the definition of fn:format-dateTime()
http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime
The cases you show are working correctly in V6 and some were broken in V5.
However I discovered that this case is NOT working right in V6 [Z0000]
Reading the text I think this is a mistake in the table it should read [Z0001]
but either case
shouldnt produce a : and does
-0004:00
I will file a bug against this one.
But for now, if you want code that works for both V5 and V6 and produces no :
create a dateTime string with no timezone then append this:
fn:replace( fn:format-dateTime($dateTime, "[Z]" ) , ":" , "")
-----------------------------------------------------------------------------
David Lee
Lead Engineer
MarkLogic Corporation
[email protected]
Phone: +1 812-482-5224
Cell: +1 812-630-7622
www.marklogic.com
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel S. Smith
(ICS)
Sent: Friday, May 03, 2013 1:40 PM
To: Mary Holstege; MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] dateTime formatting difference between ML5
and ML6
My problem is that I need to format a dateTime to match RFC822. Here are the
formats that match:
Wed, 02 Oct 2002 08:00:00 EST
Wed, 02 Oct 2002 15:00:00 +0200
I'm having trouble because ML5 and ML6 return the time zone differently.
Try this code in both versions:
xquery version "1.0-ml";
let $dateTime := fn:current-dateTime()
let $pictures := ("[Z]", "[z]", "[ZN,*-3]")
return (
for $p in $pictures
return
fn:concat($p, ' : ', fn:format-dateTime($dateTime, $p))
)
MarkLogic 5 results:
[Z] : -0600 <----------------This is good
[z] : GMT-06:00 <---------This doesn't work for RFC822 because of the offset
[ZN,*-3] : GMT-06:00 <---This doesn't work because of the offset
MarkLogic 6 results:
[Z] : -06:00 <----------This doesn't work because of the ":"
[z] : GMT-06 <-------This doesn't work because of the offset
[ZN,*-3] : GMT <----This is good (I don't need the accuracy of the offset)
Right now I'm working with ML5 but have plans to upgrade to 6.
I just want to make sure fn:format-dateTime() is behaving correctly
-----Original Message-----
From: Mary Holstege [mailto:[email protected]]
Sent: Friday, May 03, 2013 11:19 AM
To: MarkLogic Developer Discussion; Daniel S. Smith (ICS)
Subject: Re: [MarkLogic Dev General] dateTime formatting difference between ML5
and ML6
On Fri, 03 May 2013 10:06:53 -0700, Daniel S. Smith (ICS)
<[email protected]> wrote:
> My concern is that fn:fomat-dateTime formatting is different between
> versions of MarkLogic.
>
> fn:format-dateTime(fn:current-dateTime(), "[FNn,*-3], [D1,2] [MNn,*-3]
> [Y] [H01]:[m01]:[s01] [Z]")
>
> That code returns different values for ML5 and ML6. Which one is correct?
[Z] means to return the timezone as a name, so GMT-06:00 is right.
[z] means to return the timezone as an offset from GMT, so then you get GMT-06
which I think is what you want.
//Mary
NOTICE: This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any unauthorized
review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all
copies of the original message.
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general