I concur with David. This sounds more like a data issue. You either want to ignore (strip) the timezone info (for whatever reason), or resolve to the local timezone (and optionally strip the local timezone as well, just to get ‘nicer’ facet results).
I used the following code to do the latter at import on a recent project: replace(string(adjust-date-to-timezone($result, implicit-timezone())), '(Z|(\+|-)\d+:\d+)$', '') Cheers, Geert *Van:* [email protected] [mailto:general-bounces@ developer.marklogic.com] *Namens *David Lee *Verzonden:* woensdag 29 mei 2013 16:32 *Aan:* MarkLogic Developer Discussion *Onderwerp:* Re: [MarkLogic Dev General] Date Time value with timezone in Index Could you elaborate ? I Am confused. Are you asking 1) How to create a document without the timezone A) That would depend on how you create the document, could you provide the code that creates the date element ? 2) How to ignore timezone values in a dateTime element ? A1) This is not possible without changeing your data. You would have edit the document so it doesnt have timezone values A2) Your example seems to say that only -05:00 values are incorrect but the -04:00 values are correct, which might imply you only want to ignore timezone values of -05:00 ? I actually dont think that is what you want ... (but how do you know its only the -05:00 values that are adjusted ?) So to work towards an answer. What you are seeing is builtin behaviour. When given a dateTime value that has a timezone, that timezone is used when parsing and storing in the index. Furthermore the time is then converted to UTC time for the index itself. When you query if you dont specify a timezone you are using the current local time timezone for the system. This can lead to confusion if you dont know what is going on. (or even if you do). >From reading this it seems that the core problem is your data is incorrect. In which case you need to fix your documents. But are you positive of that ? Maybe the data is actually right ? ----------------------------------------------------------------------------- David Lee Lead Engineer MarkLogic Corporation [email protected] Phone: +1 812-482-5224 Cell: +1 812-630-7622 www.marklogic.com *From:* [email protected] [ mailto:[email protected]<[email protected]>] *On Behalf Of *Abhishek53 S *Sent:* Wednesday, May 29, 2013 10:10 AM *To:* MarkLogic Developer Discussion *Subject:* [MarkLogic Dev General] Date Time value with timezone in Index *Importance:* High Hi All, Somehow our content has timezone information is present inside the datetime field of content. Document1 <date>2013-05-29T09:55:05-04:00</date> Document2 <date>2013-05-29T09:55:05-05:00</date> While verifying the element values over date element I found that -05:00 timezone values are already adjusted means in index the values are 2013-05-29T09:55:05 (Document1) and 2013-05-29T10:55:05 (Document2). This is creating count mismatch for the query. Is it possible to capture the document based on the date time values ignoring the timezone Please suggest Abhishek Srivastav Systems Engineer Tata Consultancy Services Cell:- +91-9883389968 Mailto: [email protected] Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Consulting ____________________________________________ =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
_______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
