Solved

Adding minutes to a date

Posted on 2007-11-21
4
656 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

734 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