BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-29-2008, 12:41 AM   #1 (permalink)
Knows Where the Search Button Is
 
jeet.bhatt@spec-india.com's Avatar
 
Join Date: Aug 2008
Location: India
Model: 8100
PIN: N/A
Carrier: Vodafone - India
Posts: 25
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Date comparison

Please Login to Remove!

i want to setup a trial period mechanism in my application...

pls tell how to capture system date and how to compare two date...i mean is thr any function in BB api for comparing date?

thnx
__________________
Jeet
ORG::SPEC India
Ahmedabad. India
Offline  
Old 08-29-2008, 04:05 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

i use calendar for an easy configuration:
Code:
   Calendar c = Calendar.getInstance();
   c.set(Calendar.DAY_OF_MONTH, 31);
   c.set(Calendar.MONTH, Calendar.AUGUST);
   if (c.getTime().getTime() < System.currentTimeMillis())
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 09-02-2008, 08:18 AM   #3 (permalink)
Knows Where the Search Button Is
 
jeet.bhatt@spec-india.com's Avatar
 
Join Date: Aug 2008
Location: India
Model: 8100
PIN: N/A
Carrier: Vodafone - India
Posts: 25
Post Thanks: 0
Thanked 0 Times in 0 Posts
Smile Solution !!

Hi all

here is the logic of comparing dates...regarding expiry date issue


Date values stored as long values.
Every long date representation is qty of milliseconds passed from 01 jan 1970 00:00.
To compare two dates just compare two long values.

When your application starts for the first time (when there is no saved expiration date) - calculate and save expiration date in persistent store.

One day length in milliseconds is represented via constant in DateTimeUtilities class. Or you may calculate it by yourselft.

this hint is provided by rafo...

thnx rafo...thnx simon also..
__________________
Jeet
ORG::SPEC India
Ahmedabad. India

Last edited by jeet.bhatt@spec-india.com : 09-02-2008 at 08:21 AM.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.