Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

datetime manupulation

Posted on 2006-06-27
5
Medium Priority
?
207 Views
Last Modified: 2010-04-23
I wanna know the difference between two time variables:
1. char type as fetch from the datetime field from a table as follows:
select top 1 CONVERT(CHAR(5), myTime, 114) as newTime from table1
ex:10:30 (10 hour 30 min am)

2. time from system date as follows:
system.now.hour    = 11
system.now.minutes = 40

solution:
giventime - currenttime
ex: 10.30 - 11.40
note: difference in minutes

I want to know the different between these two variables.
Anyone who can suggest very simple code for this solution?


0
Comment
Question by:peterdevadoss
[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
  • 2
5 Comments
 
LVL 7

Expert Comment

by:pradeepsudharsan
ID: 16991644
 Dim a As DateTime = New DateTime(2006, 1, 1, 11, 30, 0)
        Dim a1 As String = Now.Subtract(a).Hours.ToString()
        Dim a2 As String = Now.Subtract(a).Minutes.ToString()
        Dim a3 As String = Now.Subtract(a).Seconds.ToString()
0
 
LVL 7

Accepted Solution

by:
pradeepsudharsan earned 200 total points
ID: 16991673
Dim a As DateTime = New DateTime(2006, 1, 1, 11, 30, 0)
        Dim a1 As String = (((Now.TimeOfDay.Hours - a.TimeOfDay.Hours) * 60) + (Now.TimeOfDay.Minutes - a.TimeOfDay.Minutes)).ToString() + " minutes"
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 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