INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Days between function

Days between function

(OP)
I am correct in thinking that the DaysBetween() function takes no account of leap years?
I had a look at the sources and it gets the difference between the two dates in milliseconds using DateTimetoMilliseconds() on the Start and end dates.
DateTimeToMilliseconds uses DateTimeToTimeStamp which is written in assembler, I really don't know if the data part of the array that is filled here is taking account of leap years.

My results seem to suggest that it isnt, but it might just be a difference error on my part i.e I am displaying the difference between the two dates and not the taking account of the current (start) and end dates.

Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
That's just perfectly normal Paranoia everyone in the universe has that: Slartibartfast

RE: Days between function

3
Not sure I understand correctly, but try to do a test with the code below:

CODE -->

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage( '2012/02/28 - 2012/03/01 = ' +
               IntToStr( DaysBetween(EncodeDate(2012, 2, 28),
                                     EncodeDate(2012, 3, 1)) ) +
               sLineBreak +
               '2013/02/28 - 2013/03/01 = ' +
               IntToStr( DaysBetween(EncodeDate(2013, 2, 28),
                                     EncodeDate(2013, 3, 1)) ) );
end; 

Hope it's useful.

http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos

RE: Days between function

(OP)
cheers imex, seems it does know about Feb 29th !
also I had not come across the CR/LF constant before, nice one.

Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
That's just perfectly normal Paranoia everyone in the universe has that: Slartibartfast

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close