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.

How many days between two dates

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2007, 10:50 PM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 67
Default How many days between two dates

Hello !

I'm trying to find how many days are between two dates (the first one is now, and the second one is in a table).

I've build this :
Int((Now - DateParse (Tftabledonnees.Cell("Date",3)))/10000000/60/60/24)

It seems to work when the two dates are in the same month, but it doesn't work othewise.
It would be fine if someone could help me... and if everybody in this forum could excuse me for my poor english.
Thank you.

Pascal.
Reply With Quote
  #2 (permalink)  
Old 09-21-2007, 02:34 AM
Senior Member
 
Join Date: May 2007
Posts: 174
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi, your code will get (-)negative value for future date, (+)positive value for past date. it works ok.
Just make sure of a given date, which is in a correct 'dateFormat' in using 'dateParse' statement.

ex. "9/21/2007", this should be "09/21/2007"
__________________
Rioven

DEVICE: Motorola ATRIX (Dual Core) Android 2.2.1
DESKTOP: Intel Pentium Dual-core E5200; Microsoft® Windows® Vista Home (Basic); Hard Disk:320GB; Memory:4096MB
Reply With Quote
  #3 (permalink)  
Old 09-21-2007, 03:11 AM
alfcen's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Okinawa, Ryukyu Islands
Posts: 810
Send a message via Skype™ to alfcen
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hello Pascal,
You may wish to replace
10000000/60/60/24
with the constant
cTicksPerDay

You can get rid of negative values with
Abs(x)

No apologies needed for your English

Cheers
Robert
Reply With Quote
  #4 (permalink)  
Old 09-21-2007, 10:27 AM
pmu5757's Avatar
Knows the basics
 
Join Date: Sep 2007
Location: Metz (France)
Posts: 67
Default Thanks..

Hello,
With your answers, I've found the solution.
Some dates that I used had not the right format (01/01/2007 instead of 01/01/07)
It works well now.
I also use now the constant "cTicksPerDay"

Thank you !

Pascal
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
help with dates adbftrainer Questions (Windows Mobile) 3 08-31-2008 05:56 PM
Confused sorting on SQLLite dates mikewhite Questions (Windows Mobile) 4 08-18-2008 08:16 PM
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 11:17 AM.


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