BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 04-01-2010, 12:02 AM   #1
kbramprasath
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 7100T
PIN: N/A
Carrier: job
Posts: 15
Default hi all i have problem in find number of day there in given two dates.

Please Login to Remove!

find number of day there in given two dates. that mean give two dates means calculate number of day .ex 1. 31/3/10 2. 4/4/10 my out put is 4 days finish that day .help code immeditaly
Offline  
Old 04-01-2010, 02:00 AM   #2
jacob.tabak
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: N/A
PIN: N/A
Carrier: Fledge
Posts: 43
Default

Code:
int daysPassed = getDays(date1) - getDays(date2)

public int getDays(Date date) {
	//Get the number of days that have passed since 1/1/1970 00:00:00 GMT
	long millis = date.getTime();
	double seconds = Math.floor(millis / 1000);
	double minutes = Math.floor(seconds / 60);
	double hours = Math.floor(minutes / 60);
	double days = Math.floor(hours / 24);
	return (int) days;
}
Offline  
Old 04-01-2010, 02:12 AM   #3
vivartpandey
Thumbs Must Hurt
 
Join Date: Jun 2008
Model: 9000
Carrier: Airtel
Posts: 81
Default

Quote:
Originally Posted by jacob.tabak View Post
Code:
int daysPassed = getDays(date1) - getDays(date2)

public int getDays(Date date) {
	//Get the number of days that have passed since 1/1/1970 00:00:00 GMT
	long millis = date.getTime();
	double seconds = Math.floor(millis / 1000);
	double minutes = Math.floor(seconds / 60);
	double hours = Math.floor(minutes / 60);
	double days = Math.floor(hours / 24);
	return (int) days;
}
why two time calculation

Code:
int daysPassed = getDays(date1.getTime() - date2.getTime());

public int getDays(long millis) {
	
	double seconds = Math.floor(millis / 1000);
	double minutes = Math.floor(seconds / 60);
	double hours = Math.floor(minutes / 60);
	double days = Math.floor(hours / 24);
	return (int) days;
}
__________________
blog.vimviv.com
Offline  
Old 04-01-2010, 04:22 AM   #4
kbramprasath
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 7100T
PIN: N/A
Carrier: job
Posts: 15
Default

i have another problem the second date is string format date and month only there how to calculate
Offline  
Old 04-01-2010, 04:29 AM   #5
kbramprasath
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 7100T
PIN: N/A
Carrier: job
Posts: 15
Default

i have another problem the second date is string format date and month only there how to calculate
Offline  
Old 04-01-2010, 08:30 AM   #6
Dubdub
Appleinator
 
Dubdub's Avatar
 
Join Date: Nov 2005
Location: New Hampshire
Model: App6+
OS: AJBR549
PIN: Ask
Carrier: ATT & Verizon
Posts: 20,038
Default

Please do not double post.

http://www.blackberryforums.com/deve...ng-format.html
__________________
-->>BB FAQ

-->>Stinsonddog's Tip Site!

-->>Twitter


If someone helps, tell them by clicking the Thanks button.!!
Offline  
Closed Thread



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


1pcs used TSXMFPP128K Memory Card picture

1pcs used TSXMFPP128K Memory Card

$175.00



Desktop Memory Case Tray Case for PC DDR DRAM RAM DIMM Modules - 2 fits 100 New picture

Desktop Memory Case Tray Case for PC DDR DRAM RAM DIMM Modules - 2 fits 100 New

$20.50



Memory Blister Pack Box for DDR DIMM Module Anti Static - Lot of 6 18 35 100 200 picture

Memory Blister Pack Box for DDR DIMM Module Anti Static - Lot of 6 18 35 100 200

$17.95



2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW picture

2 - RAM DRAM Tray-Container Box For Server PC Memory DIMM Modules - Fits 100 NEW

$21.90



NEW Mitsubishi A1SNMCA-8KE Memory Cassette picture

NEW Mitsubishi A1SNMCA-8KE Memory Cassette

$151.62



Bunn Ultra-2 Main Control Board FACTORY NEW 44039.1000 38710.1000  - 013 picture

Bunn Ultra-2 Main Control Board FACTORY NEW 44039.1000 38710.1000 - 013

$180.00







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