|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
years,months,daysExists a function that determined between two dates the years,months and
days? Thanks a lot. 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. > Scott M. wrote:
> dim x as date = someDate.subtract(someOtherDate) The Subtract method on the DateTime structure, when passed anotherDateTime, 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. Chris Dunaway wrote:
> Scott M. wrote: Actually, you can only get the value as days.>> 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. > As the timespan doesn't contain a starting and ending time, there is no way to determine the exact length in months and years. 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. Göran Andersson wrote:
> I stand corrected. But when you subtract a date from another date, it> Actually, you can only get the value as days. > returns a Timespan and not a date. Chris Dunaway wrote:
> Göran Andersson wrote: Yes. If you read my next sentence you see that I am referring to the >> 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. > TimeSpan structure. That implies that I concur with your observation. :) Göran Andersson wrote:
> Yes. If you read my next sentence you see that I am referring to the My mistake, I was actually replying to Scott M.'s message.> TimeSpan structure. That implies that I concur with your observation. :) 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
Adding row to table
Timer Component for VB 2005 .aspx page? XY coordinates on form XML Encoding woes... renameing Visual basic 2005 express projects Attempted to read or write protected memory. dll vs vb 2005 Numeric / Currency control webbrowser control to submit form Read data directly from a textbox and insert into a table reading e-mail from a file and encoding the read strings |
|||||||||||||||||||||||