473,394 Members | 1,841 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,394 software developers and data experts.

.net date functions

hi all,
i am writing a program for an institute where students pay their fees monthly on different dates for the courses they're registered. for example, if i pay the first fee on 24th of february, my next fee dues on 24th of march, and if you pay your first fee on 05th of december, your next fee dues on 05th of january.
the issue is i need to figure out when the fee is due for a student. my brain is completely choked on this. .net provides a function by which i could figure out the number of days through a time span between two dates, i.e.

dim timeSpan1, timeSpan2 as timeSpan
dim resultTimeSpan as timeSpan

resultTimeSpan = timeSpan2.subtract(timeSpan1)

dim noOfDays as integer = resultTimeSpan.days

the above code is ok to figure out number of days, but i need to have a chunk of code that will tell me whether a month is passed by since the last payment, and if it has, i will flag the student as defaulter.
for some of you, the problem may sound a piece of cake, dont call me a stupid cuz as i said for some reasons my brain is totally choked on that..

a bigg bigg thank in advance for the helper.
Ather Hashmi
Aug 11 '09 #1
4 2337
MrMancunian
569 Expert 512MB
.NET provides handy stuff like DateTime.Day, DateTime.Month and DateTime.Year. There is also a method called DateTime.AddMonths(int months). Check it out :-)

Steven
Aug 11 '09 #2
thanks steven for your consideration..i thought its gonna take a day or two for the reply..but it was really quick..

about the problem..may be i failed to explain the problem clearly..
see for instance.. suppose you pay your fee on 10th of every month, the last payment you made was on 10th of july.
while running the procedure today (on 11th of august) for determining all the student who have not paid the fee, i will go into the database, get your last payment date (i.e. 10th july) and compare the date with todays.there should be a decent way to find out that as of 11th of august, a month has passed by and you need to make a payment for the next month..

may be thats clear enough.. because dateTime.month only gives me the month of the given date, so do the dateTime.year and dateTime.year functions.

thanks
Aug 11 '09 #3
steven.. that was simple man..i figures it out..i dont know what was going through my mind when i was attempting it..:D
thanks anyways.. hopefully talk to u later
thanks
Ather
Aug 11 '09 #4
MrMancunian
569 Expert 512MB
No problem. Care to post the code you used to solve this (mind the Code-tags!)

Steven
Aug 11 '09 #5

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

Similar topics

5
by: ndsoumah | last post by:
Hi guys I'm having a hard time trying to validate some dates. I have a form that accept dates from users in this format (YYYY-mm-dd). I've been looking at the available datetime functions and...
8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
2
by: Noozer | last post by:
I have a textbox on one of my forms that is used to accept a time from the user. I need to write this value to a database to trigger an event later on. What I'd like to know is... Are there...
3
by: usenet | last post by:
I have inherited a table where date information was saved from PHP as a VARCHAR. (Sigh.) This means that the so-called date fields look like this : August 1, 2005, 9:09 am EDT October 13, 2004,...
4
by: Ekong, Samuel Akpan | last post by:
Hi, I am parsing a binary file and intend to read a date(not time) field encoded thus: 0xA1290B(little-endian). Now I know the date to be 12/04/2003 but just cannot get any of the known datetime...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
8
by: MLH | last post by:
Sometimes it works and sometimes it crashes. If I want "Today is " & Date$ & "." to appear in a query field, why might it work sometimes and not others? Would I be better to call a FN? Say,...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.