BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-31-2010, 08:51 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 7100T
PIN: N/A
Carrier: job
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default i want get current date and user given date field

Please Login to Remove!

i want get current date and user given date field , calculate number of day there in that inbetween (two dates).how to write code
Offline  
Old 03-31-2010, 10:05 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

See the below example... Assuming dateField is a DateField, of course.

Code:
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date(dateField.getDate()));
String year = String.valueOf(calendar.get(Calendar.YEAR)));
String month = String.valueOf(calendar.get(Calendar.MONTH) + 1); 
String day = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH));
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

1 NEW at MostElectric: 9050JCK33V20 SQUARE D 9050-JCK33V20
$59.53
1 NEW at MostElectric: 9050JCK33V20 SQUARE D 9050-JCK33V20 picture4 NEW at MostElectric: 9070EO3D13 SQUARE D 9070-EO3D13
$268.29
4 NEW at MostElectric: 9070EO3D13 SQUARE D 9070-EO3D13 picture100pcs/lot Plastic Cap Hat for 6*6mm Tactile Push Button Switch Lid Cover 2017.
$1.15
100pcs/lot  Plastic Cap Hat for 6*6mm Tactile Push Button Switch Lid Cover 2017. picture1 NEW at MostElectric: 9070T50D54 SQUARE D 9070-T50D54
$283.37
1 NEW at MostElectric: 9070T50D54 SQUARE D 9070-T50D54 picture1 NEW at MostElectric: 9070TF75D23 SQUARE D 9070-TF75D23
$127.16
1 NEW at MostElectric: 9070TF75D23 SQUARE D 9070-TF75D23 picture






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