1. Home
  2. Computing & Technology
  3. Delphi Programming
Glossary|Tips/Tricks|FREE App/VCL|Essentials|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

DaySpan

unit
DateUtils
category
date/time routines

declaration
function DaySpan(const ANow, AThen: TDateTime): double;

description
Gives the number of days (including fractional days) between two specified dates.

Contrary to DaysBetween, DaySpan function does not count only whole days. What this means is that it will NOT return 0 as the result for difference between 05/01/2003 23:59:59 and 05/01/2003 23:59:58 - where the actual difference is one *whole* day minus 1 second.

example
var dtNow, dtBirth : TDateTime;
    fracDaysFromBirth : double;

dtNow := Now;
dtBirth:=EncodeDate(1973, 1, 29);
fracDaysFromBirth := DaySpan(dtNow, dtBirth);

ShowMessage('Zarko Gajic "exists" ' + FloatToStr(fracDaysFromBirth)); 

in real code

see also
EncodeDate, IncMonth, Now, DaysBetween


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?
Explore Delphi Programming
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming

©2010 About.com, a part of The New York Times Company.

All rights reserved.