Hi Malcolm,
Seems to be a bug. Will fix it ASAP.
Thank you for your report!
Ivan Shcheklein,
Sedna Team
Build: sedna3.5.102
>
> I'm trying to calculate the number of days between 2 date values.
>
> I noticed that SEDNA returns the number of days when doing date
> subtraction,
> which makes this easy.
>
> However, the calculations seem to have a problem.
>
> In the sample XML data below, the difference between TxnDate and DueDate is
> 1, and the difference between 2011-03-12 and today is 12. The odd thing is
> that SEDNA gets the calculations correct sometimes with other situations.
>
> Am I doing something wrong? Is there another approach I should take?
>
> Sample data:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <Bills>
> <Bill>
> <TxnNumber>1265</TxnNumber>
> <VendorName>Patton Hardware Supplies</VendorName>
> <PayerName>Patton Hardware Supplies</PayerName>
> <TxnDate>2011-03-12</TxnDate>
> <DueDate>2011-04-11</DueDate>
> <TotalAmt>500.00</TotalAmt>
> <SalesTermName>Net 30</SalesTermName>
> <Status>Paid</Status>
> </Bill>
> </Bills>
>
> Query:
> let $dataset := doc("bills.xml")
> for $element in $dataset/Bills/Bill
> let $now := xs:date(fn:current-date())
> let $age := xs:date(fn:current-date())-xs:date($element/DueDate)
> let $txn_due_diff :=
> xs:date($element/DueDate)-xs:date($element/TxnDate/text())
>
> return(<row>{$element/VendorName}{$element/TxnDate}{$element/DueDate}<now>{$
>
> now}</now><age>{$age}</age><txn_due_diff>{$txn_due_diff}</txn_due_diff>{$ele
> ment/Status}</row>)
>
> Results:
> <row>
> <VendorName>Patton Hardware Supplies</VendorName>
> <TxnDate>2011-03-12</TxnDate>
> <DueDate>2011-04-11</DueDate>
> <now>2011-12-23-05:00</now>
> <age>P12D</age>
> <txn_due_diff>P-1D</txn_due_diff>
> <Status>Paid</Status>
> </row>
>
>
> Thanks,
> Malcolm
>
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> Sedna-discussion mailing list
> Sedna-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sedna-discussion
>
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Sedna-discussion mailing list
Sedna-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sedna-discussion