Solved

Adding minutes to a date

Posted on 2007-11-21
4
646 Views
Last Modified: 2008-02-01
I have the following date which I need to add a number of minutes to determine the end date, how do I achieve this
 

           _appointment.StartDate = CType(_appointment.StartDate.ToShortDateString & " " & umeStartTime.Text, Date)
           
0
Comment
Question by:rocky050371
  • 3
4 Comments
 
LVL 17

Expert Comment

by:ZeonFlash
ID: 20328157
So you need to add minutes to _appointment.StartDate AFTER you've done the CType?  Or are you trying to add number of minutes in umeStartTime.Text to get your end time?
0
 
LVL 27

Accepted Solution

by:
VBRocks earned 500 total points
ID: 20328208
In VB.NET, just do this:

_appointment.StartDate = CType(_appointment.StartDate.ToShortDateString & " " & umeStartTime.Text, Date).AddMinutes(3)

0
 
LVL 27

Expert Comment

by:VBRocks
ID: 20328227
Or, if you are trying to achieve this:

_appointment.StartDate = CType(_appointment.StartDate.ToShortDateString & " " & umeStartTime.Text, Date)

_appointment.EndDate = CType(_appointment.StartDate.ToShortDateString & " " & umeStartTime.Text, Date).AddMinutes(3)

0
 
LVL 27

Expert Comment

by:VBRocks
ID: 20328469
Another older method of adding dates and times is the DateAdd method, here's an example of adding
3 minutes:

_appointment.StartDate = DateAdd(DateInterval.Minute, 3, _
   CType(_appointment.StartDate.ToShortDateString & " " & umeStartTime.Text, Date))

        MsgBox(_appointment.StartDate.ToString())



0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Template or Software to write user guide 2 32
VB.Net - For Loop Error 5 26
Round up to 100% in .NET 10 45
VB.NET HttpWebRequest 12 34
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now