Share Your Source Code or Article

Do you have source code, articles, tutorials, web links, and books to share? You can write your own content here. You can even have your own blog.

Submit now...

Database Programming Made Easy

This tutorial will teach you step by step on how to connect and manipulate database. If you'd like to suggest a tutorial please write a comment at the bottom of this article.

Read more...

Hire Us to Do Your Work

Do you want a customized system? Do you want to setup your own website to do business? Then we are here to help you in your programming needs.

Read more...

Search

Adding minutes to a datetime variables
planetsourcecode's picture
Language: .NET
Category: Miscellaneous

Sometime we stuck in a problem in which we have to get a time which is after 20 or 60 minutes then there is simple function which can add minutes to a particular datetime variable
take an example we want to add 60 minutes to present time, for this we simply do is make an 2 objects of current datetime class i.e. date1 and date2

  1.  
  2. System.DateTime date1 = System.DateTime.Now;
  3. System.DateTime date2 = System.DateTime.Now;

after that simply add 60 minutes to the second datetime object created earlier with the help of AddMinutes method like below

  1.  
  2. System.DateTime date2new = date2.AddMinutes(60);

  1.  
  2. Method * Description
  3. Add Adds a timespan value
  4. AddDays Adds a certain number of days
  5. AddHours Adds a certain number of hours
  6. AddMilliseconds Adds a certain number of Milliseconds
  7. AddMinutes Adds a certain number of minutes
  8. AddMonths Adds a certain number of months
  9. AddSeconds Adds a certain number of seconds
  10. AddTicks Adds a certain number of ticks
  11. AddYears Adds a certain number of years
  12. GetDateTimeFormats Returns a list of available datetime formats
  13. GetHashCode Returns hashcode for a certain date. int is returned
  14. IsDaylightSavingTime Determines if a datetime object is daylightsavings
  15. Subtract Subtracts a timespan object from datetime object
  16. ToBinary Serializes object to long value to be used later
  17. ToFileTime Converts datetime to a windows file time
  18. ToLocalTime Returns a local time object as datetime
  19. ToLongDateString Returns a string as a longdate format
  20. ToLongTimeString Returns a string as a long time format
  21. ToOADate Converts a datetime object to a OLE automation date
  22. ToShortDateString Returns a short date format
  23. ToShortTimeString Returns a short time format
  24. ToString Returns a string that represents the datetime object

* http://www.meshplex.org/wiki/C_Sharp/Da ... nd_Objects

About the author:

PlanetSourceCode.in is a place for all developer providing free source codes, articles, MCA complete projects,complete application in PHP, C/C++, Javascript, Visual Basic, Cobol, Pascal, ASP/VBScript, AJAX, SQL, Perl, Python, Ruby, Mobile Development

0
Your rating: None



Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <java>, <java5>, <javascript>, <mysql>, <php>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • You may use [inline:xx] tags to display uploaded files or images inline.
  • Links to specified hosts will have a rel="nofollow" added to them.

  • You may insert videos with [video:URL]

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

Step by Step Java Tutorial

In this tutorial you will learn how to program with Java. It has a rich of information to be educated well with Java.

Read more...

Do You Have Question?

Do you have any question related to computer programming? Visit our forum and post new topic on the category you like. Be gentle when asking a question.

Ask now...

Point of Sale

Point of Sale is very useful especially for supermarkets or restaurants. I have included a barcode scanner in this program. Please check it out.

Read more...