Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

help with dates

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-31-2008, 01:09 PM
Junior Member
 
Join Date: Aug 2008
Posts: 14
Default help with dates

I have two input vars. from user using the calendar control, i want to know how many days are between the two dates, and (assign the value to another var. this part i know). Thank you for any help. I love this program, i have been using it for about a week.

Again Thank you
sue
Reply With Quote
  #2 (permalink)  
Old 08-31-2008, 01:31 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 2,344
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

You wil need to do 2 operations, first get the date equivalent in ticks...(for both dates), then subtract the dates...this gets you the icks bettwen the dates...
Overall,something likethis...

Code:
daydif=(DateParse(date2)-DateParse(date1))/(86400*10000000)
Date2: the newst date
date1: the oldestdate
daydif=(DateParse(date2)-DateParse(date1)) gets the tick value diference bettween dates
86400*10000000) is the number of tick in 1 day...
__________________
Paulo Gomes - Porto, Portugal - Living/Working in France
Mobile Device: Samsung Galaxy S, Android 2.3.4 CUstom ROM
Laptop: Toshiba NB100-130 (running on Win7Ultimate)

My Posts helped you? Consider Buying me a Porto Glass!
Reply With Quote
  #3 (permalink)  
Old 08-31-2008, 03:42 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 15,733
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

There is no need to use DateParse as the date comes from the Calendar control:
Code:
daydif = (Calendar1.Value - Calendar2.Value) / cTicksPerDay
cTicksPerDay is a constant. Its value is the number of ticks in one day.
If you want a whole number of days use:
Code:
daydif = Int((Calendar1.Value - Calendar2.Value) / cTicksPerDay)
Reply With Quote
  #4 (permalink)  
Old 08-31-2008, 05:56 PM
Junior Member
 
Join Date: Aug 2008
Posts: 14
Default Like Magic

Thank you again, you answered more than i asked, it was EXTREMELY HELPFUL.
The code worked like a charm. NEVER have i seen a program that was tailored for the component of my business. I am writing my own. This is very important to me. sue
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
error count days between dates mike2ppc Questions (Windows Mobile) 1 10-23-2008 09:44 PM
Confused sorting on SQLLite dates mikewhite Questions (Windows Mobile) 4 08-18-2008 08:16 PM
How many days between two dates pmu5757 Questions (Windows Mobile) 3 09-21-2007 10:27 AM
Difference Between Two Dates dvanwig Questions (Windows Mobile) 7 08-02-2007 04:29 AM
How can i compare 2 Dates Fontanus Questions (Windows Mobile) 3 05-04-2007 09:37 PM


All times are GMT. The time now is 10:19 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0