473,661 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

years,months,da ys

Exists a function that determined between two dates the years,months and
days?

Thanks a lot.
Jun 3 '06 #1
8 1763
dim x as date = someDate.subtra ct(someOtherDat e)

Then format x as desired.

"Jose" <jo********@uni ca.com> wrote in message
news:ui******** ******@TK2MSFTN GP04.phx.gbl...
Exists a function that determined between two dates the years,months and
days?

Thanks a lot.

Jun 3 '06 #2
Scott M. wrote:
dim x as date = someDate.subtra ct(someOtherDat e)


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.Subtra ct(someOtherDat e)

Then you can get the years, months, and days properties from the
TimeSpan.

Jun 5 '06 #3
Chris Dunaway wrote:
Scott M. wrote:
dim x as date = someDate.subtra ct(someOtherDat e)


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.Subtra ct(someOtherDat e)

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.
Jun 5 '06 #4
or you could use a real function like DateDiff right?

who the hell changes a function like DateDiff??

-Aaron
Göran Andersson wrote:
Chris Dunaway wrote:
Scott M. wrote:
dim x as date = someDate.subtra ct(someOtherDat e)


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.Subtra ct(someOtherDat e)

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.


Jun 5 '06 #5
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.

Jun 6 '06 #6
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
Jun 6 '06 #7
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. :)
Jun 6 '06 #8
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.

Jun 7 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
27967
by: carl.barrett | last post by:
Hi, I have a continuous form based on a query ( I will also be creating a report based on the same query). There are 2 fields: Date Obtained and Date Of Expiry I want a further 3 columns to the right of these 2 fields to show the
5
8824
by: Juan | last post by:
Hi everyone, is there a function that calculates the exact amount of Years, Months, and Days between two days? TimeDiff is not good enough, since it calculates, for example: Date 1: Dec. 31st 2003 Date 2: Jan 1st 2004
1
1389
by: ann | last post by:
is there someway to disable the Other Months day(the previous and next months days) s from appearing? If so, can you let me know how? Thanks so much for your help!
3
1928
by: Trevor | last post by:
This is driving us mad - please help! Back in 2003, I coded a Windows Service in VB.NET for framework v1.1.4322. I deployed it in Nov. 2003, and it worked fine until the end of May 2005, when it choked (see below). We restarted it, and it worked fine for another 7 months until it choked again at the end of Dec. 2005. It has now failed again (mid Feb. 2006). So it's failing more frequently now? OnStart, the service reads a number of...
37
2281
by: Gregc. | last post by:
G'day I'm trying to work out the number of years since 1970, here is my code: include <stdio.h> #include <time.h> const int SEC_IN_MIN = 60; const int SEC_IN_HOUR = SEC_IN_MIN * 60;
5
5308
by: mukesh | last post by:
Dear freinds, I need date difference in terms of years/months/days i.e. i want to create a calculated field to show the age of person in year months and days. The DateDiff() expression of MS Access calculates the age in years only and do not show the month and days. Will you please help me thanks a lot in advance
2
1350
by: vsankar9 | last post by:
End date - 31-DEC-2007 Termination as of date - 15-MAR-2007 Rate - 1000 (monthly rate ) Termination value =( 9 Months * 1000 )+ (16 days * 1000 / 30) = 9000 + 533.33 = 9533.33
15
42613
karthickkuchanur
by: karthickkuchanur | last post by:
Hai sir, i assigned to calculate the age from current date ,i have the date of birth of employee from that i have to calculate the age dynamically, i refer to google it was confusing me .please give some idea to do sir
2
4010
by: johanneguaybenoit | last post by:
Hi I would like to know how to create a function or module to calculate the age of a person in years months days. and hours if feasable But I really nead to know in years months days. I am waiting a reply from you and many thanks for your help in advance. Johanne
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.