Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100
Accepted Solution

Date in miliseconds

How can I know if one date given in miliseconds belongs to today in an easy way? Did you do something similar?

 

Thanks.

Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Date in miliseconds

Now i just found that maybe DateTimeUtilities.isSameDate() could do it. I am going to check it out.

Thanks anyway.

Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Date in miliseconds

I was wrong, it didn't work out...

Developer
Posts: 16,582
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Date in miliseconds

what did not work? i use the same utilities with success.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Date in miliseconds

[ Edited ]

I try to compare two dates (in miliseconds) which belongs to the same day with this method and I get false, but if you say it worked for you, i will have a look to see if i'm doing something wrong.

Developer
Posts: 16,582
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Date in miliseconds

here is my code:

DateTimeUtilities.isSameDate(System.currentTimeMillis(), item.getDateOfBegin().getTime())

 

another option would be to create calendar instances and compare the year, month and day.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 588
Registered: ‎05-29-2009
My Device: 9100

Re: Date in miliseconds

Thanks a lot. You are totally right.