Solved

Adding minutes to a date

Posted on 2007-11-21
4
655 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to duplicate form in Visual Studio 2015 2 98
FInd Image Control Gridview 3 37
Crystal reports login after closing form 3 36
Find date of 2nd Thursday of each month 3 34
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 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