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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:40:51+00:00 2026-06-04T04:40:51+00:00

I am using the calendar library to save the date from my app. I

  • 0

I am using the calendar library to save the date from my app. I am using sqlite3 and can only save ints and strings to my db. Calendar converts to a long that when converts back shows the correct date. However to save it in my db I have to convert it to an int. When I convert the int back to a long and use setTimeInMillis(), my date changes. I know that when you covert from long to an int you lose precision. Is there a work around? I was told that I have to use the calendar library for what I am doing. Below is the code that is giving me problems, any ideas. Already did a google search and did not have any luck

    long timing=0;
    timing =dateAndTime.getTimeInMillis();
    testDate.setTimeInMillis(timing);
    int dates=  (int) timing;
    timing=dates;
    testDate.setTimeInMillis(timing);
  • 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-04T04:40:52+00:00Added an answer on June 4, 2026 at 4:40 am

    It’s not that you’re losing precision. It’s more that a long holds more bytes than an integer so you’re gonna lose whatever data the int can’t hold. You’re better off converting the long to a String and storing it as that (Long.toString(l)). When you want to get it out of the database just parse the String into a long (Long.parseLong(s)).

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

Sidebar

Related Questions

How can I display the time in the current app locale using Calendar? For
I'm using jcal2 calendar for choosing date from calender. It working when i'm using
Possible Duplicate: How to get date of last Friday from specified date? Using java.util.Calendar
How can I get all items from a specific calendar (for a specific date).
I'm using the Date Picker from the Telerik MVC library. It appears and works
Building an app using a calendar on a Google Apps domain that has SSL
I am using zendgdata library for google calendar. I am getting this error while
In my rails app, I am using calendar helper cell.innerHTML = '<%= calendar_for('start_date')%>'; The
I m Using a calendar.js file to implement calendar in my App. Actually this
I'm writing an app for a company that uses Google Calendar internally and would

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.