Home All Groups Group Topic Archive Search About
Author
3 Jun 2006 8:10 PM
Jose
Exists a function that determined between two dates the years,months and
days?

Thanks a lot.

Author
3 Jun 2006 8:56 PM
Scott M.
dim x as date  = someDate.subtract(someOtherDate)

Then format x as desired.



Show quoteHide quote
"Jose" <josenospam@unica.com> wrote in message
news:uid6zm0hGHA.2456@TK2MSFTNGP04.phx.gbl...
> Exists a function that determined between two dates the years,months and
> days?
>
> Thanks a lot.
>
Author
5 Jun 2006 2:28 PM
Chris Dunaway
Scott M. wrote:
> dim x as date  = someDate.subtract(someOtherDate)

The Subtract method on the DateTime structure, when passed another
DateTime, returns a Timespan object and not a DateTime object.

Dim ts As TimeSpan = someDate.Subtract(someOtherDate)

Then you can get the years, months, and days properties from the
TimeSpan.
Author
5 Jun 2006 4:53 PM
Göran_Andersson
Chris Dunaway wrote:
> Scott M. wrote:
>> dim x as date  = someDate.subtract(someOtherDate)
>
> The Subtract method on the DateTime structure, when passed another
> DateTime, returns a Timespan object and not a DateTime object.
>
> Dim ts As TimeSpan = someDate.Subtract(someOtherDate)
>
> Then you can get the years, months, and days properties from the
> TimeSpan.
>

Actually, you can only get the value as days.

As the timespan doesn't contain a starting and ending time, there is no
way to determine the exact length in months and years.
Author
5 Jun 2006 10:39 PM
aaron.kempf@gmail.com
or you could use a real function like DateDiff right?

who the hell changes a function like DateDiff??

-Aaron


Göran Andersson wrote:
Show quoteHide quote
> Chris Dunaway wrote:
> > Scott M. wrote:
> >> dim x as date  = someDate.subtract(someOtherDate)
> >
> > The Subtract method on the DateTime structure, when passed another
> > DateTime, returns a Timespan object and not a DateTime object.
> >
> > Dim ts As TimeSpan = someDate.Subtract(someOtherDate)
> >
> > Then you can get the years, months, and days properties from the
> > TimeSpan.
> >
>
> Actually, you can only get the value as days.
>
> As the timespan doesn't contain a starting and ending time, there is no
> way to determine the exact length in months and years.
Author
6 Jun 2006 1:12 PM
Chris Dunaway
Göran Andersson wrote:
>
> Actually, you can only get the value as days.
>

I stand corrected.  But when you subtract a date from another date, it
returns a Timespan and not a date.
Author
6 Jun 2006 5:08 PM
Göran_Andersson
Chris Dunaway wrote:
> Göran Andersson wrote:
>> Actually, you can only get the value as days.
>>
>
> I stand corrected.  But when you subtract a date from another date, it
> returns a Timespan and not a date.
>

Yes. If you read my next sentence you see that I am referring to the
TimeSpan structure. That implies that I concur with your observation. :)
Author
7 Jun 2006 1:11 PM
Chris Dunaway
Göran Andersson wrote:
> Yes. If you read my next sentence you see that I am referring to the
> TimeSpan structure. That implies that I concur with your observation. :)

My mistake, I was actually replying to Scott M.'s message.
Author
6 Jun 2006 2:19 PM
Cor Ligthert [MVP]
Jose,

In my idea does this never work as measuring system. Somehow I thought it is
not possible with the Gregorian Calender, every month can have a different
length you know, not to talk about leap years. Therefore it is not such a
good measuring system.

Therefore
Date - Date represented as year, months, will  will give a total other
result in by instance days as you use another startdate and add your
measured result.

(Years, weeks, days) or (years, days) will do a better job.
Although the leap year problem sustains..

That is the reason that some people want to use this kind of calendars.

http://en.wikipedia.org/wiki/Positivist_Calendar

But just my thought.

Cor