473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

count year to year between two dates

i'm creating assets tracking data base, i have to set asset depreciation every year of asset life, i am using datediff() but it count total duration of asset, i want that starting date and ending date and computer count integer number until the ending date for example purchased asset date 12-Aug-2010 useful life of Asset is 12-Aug-2014, between both dates computer account automatically number that has been passed ..
Aug 19 '14 #1
1 1098
twinnyfo
3,653 Expert Mod 2GB
irfanEmmaneul,


Try a public function similar to this:

Expand|Select|Wrap|Line Numbers
  1. Public Function WhatIsAge(AssetDate As Date) As String
  2.     Dim intYears As Integer
  3.     Dim intMonths As Integer
  4.     Dim intDays As Integer
  5.     intYears = Format(Date - AssetDate, "yy")
  6.     intMonths = Month(Date - AssetDate) - 1
  7.     intDays = Day(Date - AssetDate)
  8.     WhatIsAge = "Asset is " & _
  9.         intYears & " years, " & _
  10.         intMonths & " months, " & _
  11.         intDays & " days old."
  12. End Function
It may be a good place to start. Hope this hepps!
Sep 8 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed...
3
by: Matt | last post by:
Hello, I have a query that I would like to schedule in DTS. The criteria of this query checks for records in the table that are within the current quarter. Here is what I have. WHERE...
4
by: Alicia | last post by:
I am having a problem grouping by week. I am looking for the simpliest way of doing it in Microsoft Access. I have tried to use a pre-loaded calender, access did not like it at all. If there is...
1
by: Alicia | last post by:
I basically wanted something that would do a count of the dates, then group them by their week name.. BEFORE: Resource Date Total number of times that date Appeared (Count) 4/3/03 ...
5
by: moddster | last post by:
Hi Guys. I am a newbie to perl and need some help with a problem. PROBLEM: I have to parse an HTML file and get rid of all the HTML tags and count the number of sumbissions a person has through...
9
by: sha2484 | last post by:
I need help to count days between 2 dates,where i want to count the days between current date and registeration date.Here is the code that i have write but it only compare the days , it do not...
1
by: kummu4help | last post by:
hi, i am using mysql. i have 3 tables with following structures. these are not actual tables i am working on. table A id varchar(16),name varchar(255),InDate datetime table B id...
11
wordbrew
by: wordbrew | last post by:
Hello all, I’m beginning to get a pretty good foundation in VBA, but I can’t wrap my head around this problem, even after trolling around the net searching through other posts that seemed remotely...
2
zaffer
by: zaffer | last post by:
SELECT trunc(sysdate) dt, count(*) as count FROM ATM_MONITOR.ATM_PROBLEM WHERE trunc(sysdate) = trunc(create_time) union SELECT trunc(sysdate)-1 dt, count(*) as count FROM...
7
by: time2hike | last post by:
Hi, I am struggling with pulling data for multiple projects and then standardizing the data so it can be used in modeling and comparisons. Overview: We are building a modeling system that allows...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.