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 8248445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:11:25+00:00 2026-06-07T23:11:25+00:00

I have a database that holds times at which i need to run certain

  • 0

I have a database that holds times at which i need to run certain processes
I do a query which gives me the difference between the current time and the time at which i’m supposed to run the process
For example, I might get this number 23:49:44.835 which means i need to run the process in about 23 hours.
I want to get this process in milliseconds, so I have done this

Date Date = (java.util.Date) (InMsgTstable[index][0]);
long Value3 = Date.getTime();

The date value i get is correct, though it drops the milliseconds value that is stored in my database.
I want to get this number of hours/minutes etc.. in milliseconds so i can put that number as a millisecond delay in a scheduler. However, this is giving me the wrong value in milliseconds.
Any tips?

  • 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-06-07T23:11:27+00:00Added an answer on June 7, 2026 at 11:11 pm

    If you are in control of the database table, I would change the column type to an integer type and simply store the timestamp in milliseconds as an integer value.

    That will allow you to treat the value as the timestamp that Date and Calendar use natively without having to handle the conversions that databases perform on date and time columns.

    Edit

    From your comment above I see that the value you get looks like the number of milliseconds since the start of the current day (which is by definition localtime, so beware of timezone values in the database.)

    The date that you create using this timestamp is situated in Jan 1 1970, which is not what you want.

    What you could do is to create a calendar object which defaults to “now”, back-up to the start of day and get that timestamp to add to the value you got from the database, something like (untested):

    Calendar cal = Calendar.getInstance();
    
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    
    long stamp = cal.getTime().getTime() + msgTableValue;
    
    Date dat = new Date(stamp);
    

    which should give you a Date object representing msgTableValue milliseconds into the current day.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a database that holds order numbers and order information.
I have a database that which contains two tables, links and tour. Tour is
To begin with, I have a database that holds map data for a game
I have a database that has two tables, one of which contains a foreign
I'm really upset with Hibernate! I have a database table (mysql) that holds parent-child
I have a database which holds URL's in a table (along with other many
I have a MySQL database that holds a list of classes in columns, and
I have two databases in SQL2k5: one that holds a large amount of static
i have DataBase function that calculate distance by coordinates CREATE OR REPLACE FUNCTION distance(lat1
I have a database that has around 10k records and some of them contain

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.