This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 15, 2011, 1:59 PM
29 Posts

Re: Dates comparison issue

  • Category: Debugging
  • Platform: All
  • Release: 8.5.2
  • Role:
  • Tags:
  • Replies: 6
 Hi again,
 
didn't work. What I did was: 
1) i got 3 dates : 2 from fields on Xpage, 1 from NotesDocument to make a comparison : (1)xPage<=documentDate<=(2)xPage
2) Got .toString representation of all the 3 dates
3) sent them to the function which formatted them all as dd.mm.yy:
 
var dat1=new Date(); 
dat1.setDate(date.left(2));
dat1.setMonth(date.mid(3,2)-1);
dat1.setFullYear(date.right(4));
 
4) I checked values via console: (1) xPage = 31.12.10 , documentDate=01.02.11 , (2)xPage = 01.03.11
5) then I get the already mentioned result of comparison: 
31.12.10 <=01.02.11 False 
01.02.11 <= 01.03.11 True 
Apr 15, 2011, 2:20 PM
29 Posts
Re: Dates comparison issue
Turned out to be tricky, but the only method which worked was applying    .valueOf()  to the dates and comparing the numeric representation.
It worked only this way. 
Apr 15, 2011, 2:50 PM
261 Posts
Re: Dates comparison issue
Hi Ruslan,
 
If you want to compare Java dates, you can also use the getTime() method (which returns number of milliseconds since midnight of January 1, 1970) or use the compareTo() method.
 
To easily transform a NotesDateTime object to a Java date you can use the NotesDateTime.toJavaDate() method.
 
 
Apr 15, 2011, 3:01 PM
29 Posts
Re: Dates comparison issue
 Hi, Mark! I wish I had known about conversion earlier. I used to work mostly with LotusScript till now and it's my first time I get into this kind of trouble %-)
Thank you for the advice, guys! You're all really helpful here! 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal