Hi everyone!!
I got stuck of this problem. How do i compare two dates in J2me. Please provide me some source code if anyone have. Please it's an urgent requirement.
Please Reply.
Hi everyone!!
I got stuck of this problem. How do i compare two dates in J2me. Please provide me some source code if anyone have. Please it's an urgent requirement.
Please Reply.
Regards
Rajan Verma
Well, it would help if you told us more about your situation... Like whether you're talking about the Date class or something else.
Does the equals method do what you need? If not, you could use the getTime method and compare the resulting numbers.
Last edited by bogdan.galiceanu; 2011-02-17 at 11:21.
Thanks for the reply..
I want to compare the dates in the followin format :
compareDate(todayDate,selectedDate)
todayDate is the Current Date.
Selected date is Date selected fromt the Calendar.
Now the difference between the two dates could not be greter than 6 months.
That is the
Date d = todyaDate - selectedDate (Let for an example).
d should not be greater than 6 months.
Please Reply.
Last edited by rajan701v; 2011-02-17 at 11:18.
Regards
Rajan Verma
Hi rajan,
I don't know about the LWUIT . But normally you can do like if you have current date in millis and past date in millis
You an do like :
With this you will get the number of days now you can check the difference.long currentDateMilliSec = curent time
long selecteddate= selected date
long diffDays = (currentDateMilliSec - selecteddate) / (24 * 60 * 60 * 1000);
Ok. I will reply for the same.
Is it possible to create our own Calendar. With our own look and feel.
Please Reply.
Regards
Rajan Verma
Hey Rajan hope this is not late, however with dates you can us dateObject.getTime() to get the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.
Then you use those seconds for comparison
example
long timeDiff = selectedDate.getTime() - todyaDate.getTime() ;
Then u can compute whatever you want using the timeDiff variable which is in milliseconds.
Regards
Ivan Walulya
Yes, it possible either extend the LWUIT Canlendar component or create your own extending LWUIT form.
Refer to --> http://wiki.forum.nokia.com/index.ph...ar/date_picker