I have a date value (e.g. 2011-04-11 07:45:00.000) which I am pulling from my database (via Entity Framework). I need to pull out only the hour from the original date value (e.g. 07:45:00), get the current time, and then subtract the current time from the database time value. In pseudo-code, I’m looking to do something like this:
Dim my_date as DateTime = from_db ' This is the value pulled from the database.
Dim this_date as DateTime = Date.Now ' This is pulled via a VB.NET function.
Dim my_hour = my_date_but_only_hours ' Somehow, I need to strip the date off the my_date
Dim this_hour = this_date_but_only_hours ' Same as line above.
Dim hour_difference = my_hour - this_hour
Response.Write("There are " & hour_difference & " hours left before the time runs out.")
If you just want the hour, proceed with: