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
Solved

Adding minutes to a date

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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 …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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