<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">One way would be to do dateOfBirth.time < nnnnnn<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Where nnnnn is (new Date(-1900, 1,1)).getTime()<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">By the way be very very wary of Date objects coming back from the database and check what the actual implementation class type is (and not the variable type).
Even though java.sql.Timestamp extends java.util.Date they don’t mix. <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">From the Javadocs<o:p></o:p></span></p>
<p style="background:white"><b><span style="font-size:13.5pt;color:black">Note:</span></b><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">This type is a composite of a<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">and
a separate nanoseconds value. Only integral seconds are stored in the<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">component.
The fractional seconds - the nanos - are separate. The</span><code><span style="font-size:10.0pt;color:black">Timestamp.equals(Object)</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">method
never returns<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">true</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">when
passed an object that isn't an instance of<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.sql.Timestamp</span></code><span style="font-size:13.5pt;color:black">, because the nanos component of a date
is unknown. As a result, the</span><code><span style="font-size:10.0pt;color:black">Timestamp.equals(Object)</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">method
is not symmetric with respect to the<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date.equals(Object)</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">method.
Also, the<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">hashcode</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">method
uses the underlying<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">implementation
and therefore does not include nanos in its computation.<o:p></o:p></span></p>
<p style="background:white;orphans: 2;text-align:-webkit-auto;widows: 2;-webkit-text-size-adjust: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:13.5pt;color:black">Due to the differences between the<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">Timestamp</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">class
and the<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">class
mentioned above, it is recommended that code not view<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">Timestamp</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">values
generically as an instance of<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span style="font-size:13.5pt;color:black">. The inheritance relationship between<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">Timestamp</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">and<span class="apple-converted-space"> </span></span><code><span style="font-size:10.0pt;color:black">java.util.Date</span></code><span class="apple-converted-space"><span style="font-size:13.5pt;color:black"> </span></span><span style="font-size:13.5pt;color:black">really
denotes implementation inheritance, and not type inheritance.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">We had great fun tracking down issues in our rules caused by this – our fields were Date classes, but when fetched back from the database the instance type
would be Timestamp. The rules worked fine in unit tests and first execution (as they were all new objects the type was java.util.Date) but not on subsequent executions when they were returned from the DB!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thomas<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
<b>On Behalf Of </b>Nancy Henggeler<br>
<b>Sent:</b> 09 February 2012 17:24<br>
<b>To:</b> Rules Users List<br>
<b>Subject:</b> Re: [rules-users] Low Date question in drools<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif"">It is a java date. We use some java binding objects to build it. Below is just a sampling of this. The second entry below indicates what to name it in Java, it's java type,
what DB2 table (cogentTable) and data field it is coming from (cogentField). The snippets below might not help much.</span>
<br>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Courier New"">1) bindHistory((ECDField) object.getElement("dateOfBirth"), this.getDateOfBirthHistory());</span>
<br>
<br>
<span style="font-size:10.0pt;font-family:"Courier New"">2) <attribute name="dateOfBirth"></span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> <type>Date</type></span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> <cogenTable>W1V0</cogenTable></span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> <cogenField>BIRTH-DATE</cogenField></span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> <description>Date Of Birth</description></span>
<br>
<span style="font-size:10.0pt;font-family:"Courier New""> </attribute></span>
<br>
<br>
<br>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">From: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Wolfgang Laun <<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>></span>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">To: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Rules Users List <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>></span>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Date: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">02/09/2012 11:00 AM</span>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Subject: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Re: [rules-users] Low Date question in drools</span>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F">Sent by: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif""><a href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a></span>
<o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" noshade="" style="color:#A0A0A0" align="center">
</div>
<p class="MsoNormal"><br>
<br>
<br>
So what is the Java type of dateOfBirth, please? <br>
-W<br>
<br>
2012/2/9 Nancy Henggeler <<a href="mailto:Nancy.Henggeler@fblfinancial.com">Nancy.Henggeler@fblfinancial.com</a>>
<br>
<span style="font-family:"Arial","sans-serif"">Hello Laun,</span> <br>
<span style="font-family:"Arial","sans-serif""><br>
Thank you for your quick response. This date is a date coming from a DB2 date field and is valid in my incoming data. Frankly, I am with you, why not null versus a silly low date as such, arggggh. But since it is coming in as such do you know of a work around?</span>
<br>
<span style="font-family:"Arial","sans-serif""><br>
Thank so much,</span> <span style="font-family:"Arial","sans-serif""><br>
Nancy</span> <br>
<br>
<br>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
From: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Wolfgang Laun <</span><a href="mailto:wolfgang.laun@gmail.com" target="_blank"><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">wolfgang.laun@gmail.com</span></a><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">></span>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
To: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Rules Users List <</span><a href="mailto:rules-users@lists.jboss.org" target="_blank"><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">rules-users@lists.jboss.org</span></a><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">></span>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
Date: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">02/09/2012 10:31 AM</span>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
Subject: </span><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">Re: [rules-users] Low Date question in drools</span>
<span style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#5F5F5F"><br>
Sent by: </span><a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank"><span style="font-size:7.5pt;font-family:"Arial","sans-serif"">rules-users-bounces@lists.jboss.org</span></a>
<o:p></o:p></p>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="100%" noshade="" style="color:#A0A0A0" align="center">
</div>
<p class="MsoNormal"><br>
<br>
<br>
Why would you want to test for January 1st in year 1? This is not a <br>
value an object of type java.util.Date can represent. See that type's <br>
javadoc for details, but the epoch begins January 1, 1970. <br>
<br>
-W <br>
<br>
<br>
On 9 February 2012 17:19, Nancy Henggeler <<a href="mailto:nancy.henggeler@fblfinancial.com" target="_blank">nancy.henggeler@fblfinancial.com</a>> wrote:
<br>
I have a simple rule where I want to bypass elements that have a low date but<br>
drools seems to be interpreting the date different then I am expecting.<br>
Drools statement and error follows:<br>
<br>
ClientSupplement ( dateOfBirth : dateOfBirth != null && != 0001-01-01)<br>
<br>
throws error -- Error: [Error: badly formatted number: For input string:<br>
"001-01-01"] [Near : {... 0001-01-01 ....}] ^ [Line: 1, Column: 1]<br>
<br>
How do I get drools to understand this low date? I have tried single,<br>
double, and no quotes around the low date and all result in a similiar error<br>
message. Please Help!<span style="color:#8F8F8F"><br>
<br>
--<br>
View this message in context: </span><a href="http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3729940.html" target="_blank">http://drools.46999.n3.nabble.com/Low-Date-question-in-drools-tp3729940p3729940.html</a><span style="color:#8F8F8F"><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list</span><u><span style="color:blue"><br>
</span></u><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><u><span style="color:blue"><br>
</span></u><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a>
<span style="font-family:"Courier New""><br>
<tt>_______________________________________________</tt><br>
<tt>rules-users mailing list</tt><u><span style="color:blue"><br>
</span></u></span><a href="mailto:rules-users@lists.jboss.org" target="_blank"><tt>rules-users@lists.jboss.org</tt></a><u><span style="color:blue"><br>
</span></u><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank"><tt>https://lists.jboss.org/mailman/listinfo/rules-users</tt></a><o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="background:white;padding:.75pt .75pt .75pt .75pt">
<p class="MsoNormal"><tt>The information contained in this message may be privileged and confidential and protected from disclosure. If you are</tt><span style="font-family:"Courier New""><br>
<tt>not the intended recipient of this message, you are hereby notified that any dissemination, distribution, or copying of this</tt><br>
<tt>communication is strictly prohibited. If you have received this communication in error, please notify us immediately by</tt><br>
<tt>replying to the message, and please delete it from your computer.</tt></span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
_______________________________________________<br>
rules-users mailing list<u><span style="color:blue"><br>
</span></u><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><u><span style="color:blue"><br>
</span></u><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<tt><span style="font-size:10.0pt">_______________________________________________</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt>rules-users mailing list</tt><br>
<tt><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></tt><br>
</span><a href="https://lists.jboss.org/mailman/listinfo/rules-users"><tt><span style="font-size:10.0pt">https://lists.jboss.org/mailman/listinfo/rules-users</span></tt></a><o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellpadding="0">
<tbody>
<tr>
<td style="background:white;padding:.75pt .75pt .75pt .75pt">
<pre><span style="color:black">The information contained in this message may be privileged and confidential and protected from disclosure. If you are<o:p></o:p></span></pre>
<pre><span style="color:black">not the intended recipient of this message, you are hereby notified that any dissemination, distribution, or copying of this<o:p></o:p></span></pre>
<pre><span style="color:black">communication is strictly prohibited. If you have received this communication in error, please notify us immediately by<o:p></o:p></span></pre>
<pre><span style="color:black">replying to the message, and please delete it from your computer.<o:p></o:p></span></pre>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
**************************************************************************************<br>
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data
may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.<br>
<br>
NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00<br>
**************************************************************************************<br>
</font>
</body>
</html>