Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4334390
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:31:21+00:00 2026-05-21T10:31:21+00:00

I have a date value (e.g. 2011-04-11 07:45:00.000) which I am pulling from my

  • 0

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.")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:31:22+00:00Added an answer on May 21, 2026 at 10:31 am
    Dim dbDate = from_db.TimeOfDay  'This gets you a TimeSpan object representing just the time of day in that date. 
    

    If you just want the hour, proceed with:

    dim dbHour = dbDate.Hour
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this value, 2011-11-19T00:00:00.000-03:00 which needs to be converted and set it in
I have the follow data returned via JSON {rows:[{Date:07/10/2011,Value:1206,Action:Drink}, {Date:07/11/2011,Value:2288,Action:Pie}, {Date:07/12/2011,Value:1070,Action:Drink}, {Date:07/13/2011,Value:1535,Action:Beer}, {Date:07/14/2011,Value:1721,Action:Drink}], page:1,total:1,records:5}
I have a date converted to double value and saved in database. Now, I
I have a table that have sigh in and sign out value **id Date
I have a phpmyadmin database with 1 000 000 record i need to search
I have the following xml: <transactionSearchResult> <resultsInThisPage>14</resultsInThisPage> <currentPage>1</currentPage> <totalPages>1</totalPages> <date>2011-10-28T11:20:10.000-02:00</date> <transactions> <transaction> <date>2011-06-17T18:21:03.000-03:00</date> <reference>ba3b7d36-a9e6-4d48-82b8-edf31a18fa49</reference>
I have a (date time) stored in database in this format 2011-10-12 02:01:24 when
In a cell in Excel sheet I have a Date value like: 01/01/2010 14:30:00
I have a start date value to be entered in a textbox in dd/mm/yyyy
I have an input that holds a date value like so 03/15/2012 I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.