Hi Dharam,

As Gang Yan indicated, comparing date entries using longs is far simpler than using Date strings.

Also, have you noticed that you have 2 "from /Event e" clauses in your query.

There is an ongoing discussion about a ways how to better handle unstructured data and how to describe the data fields.

--Udo


On 5/11/17 07:50, Gang Yan wrote:

If you convert it to long, do not need to_date for the long field again.

Thacker, Dharam <[email protected] <mailto:[email protected]>>于2017年5月11日 周四下午10:48写道:

    Ok even if I convert it long format, how I can use that in compare
    expression

    Assuming data as below,

    {"id":"5","eventId":"Event4","intField":400,"currentDate":
    1471254472000,"legalDate": 1471254472000}

    select e from /Event e where to_date(e.currentDate,'yyyy/MM/dd') >
    to_date(‘2018/02/20’,’yyyy/MM/dd’) from /Event e

    Query is invalid due to error - Syntax error in query- expecting
    StringLiteral, found 'e'

    Regards,

    Dharam

    *From:*Gang Yan [mailto:[email protected] <mailto:[email protected]>]
    *Sent:* Thursday, May 11, 2017 8:11 PM
    *To:* [email protected] <mailto:[email protected]>
    *Subject:* Re: How to handle string as java date type

    hi  Dharam

    maybe you can try to_date.

    but for reason of performance, I think that you can choose a long
    to represent a date value instead of a string.


    Thanks and regards

    Gang Yan(闫钢)

    Sr. Solution Architect

    Customer Success, Pivotal Great China

    Mobile:+86 13636347460

    [email protected] <mailto:[email protected]>

    2017-05-11 21:43 GMT+08:00 Thacker, Dharam
    <[email protected] <mailto:[email protected]>>:

    Hi Team,

    Is there any good way to play with DateType if I have PdxInstance
    data having date string with type [java.lang.String]?

    *_Example:_*

    "duedates": {

    "legalDate": "2022-04-19",

    "currentDate": "2022-04-19",

    }

    My goal is to get results based on date comparison,

    select i from /Event i where i.duedates.legalDate > ‘2022-04-15’

    Thanks & Regards,

    Dharam

    This message is confidential and subject to terms at:
    http://www.jpmorgan.com/emaildisclaimer
    <http://www.jpmorgan.com/emaildisclaimer> including on
    confidentiality, legal privilege, viruses and monitoring of
    electronic messages. If you are not the intended recipient, please
    delete this message and notify the sender immediately. Any
    unauthorized use is strictly prohibited.

    This message is confidential and subject to terms at:
    http://www.jpmorgan.com/emaildisclaimer
    <http://www.jpmorgan.com/emaildisclaimer> including on
    confidentiality, legal privilege, viruses and monitoring of
    electronic messages. If you are not the intended recipient, please
    delete this message and notify the sender immediately. Any
    unauthorized use is strictly prohibited.

--
null

Reply via email to