Link to home
Start Free TrialLog in
Avatar of peterdevadoss
peterdevadoss

asked on

datetime manupulation

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?


Avatar of pradeepsudharsan
pradeepsudharsan

 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()
ASKER CERTIFIED SOLUTION
Avatar of pradeepsudharsan
pradeepsudharsan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial