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

  • Home
  • SEARCH
  • 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 8560533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:17:50+00:00 2026-06-11T16:17:50+00:00

i have a String x = 1086073200000 . This is basically millisecond which I

  • 0

i have a String x = “1086073200000” . This is basically millisecond which I need to convert to a Date.

To convert i am using

DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");

long tempo1=Long.parseLong(x);
System.out.println(tempo1);  // output is 86073200000 instead of the whole thing
long milliSeconds=1346482800000L;

Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliSeconds);
System.out.println(formatter.format(calendar.getTime())); 

The problem is when i convert the string x to long , some digits go away due to the limit on the size of long.

How do I preserve the entire String.

THanks.

  • 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-11T16:17:51+00:00Added an answer on June 11, 2026 at 4:17 pm
    double tempo=Double.parseDouble(z);
    

    Why are you parsing your String which is supposed to be a Long as a Double?

    Try using Long.parseLong:

    String x = "1086073200000"
    
    DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    
    long milliSeconds= Long.parseLong(x);
    System.out.println(milliSeconds);
    
    Calendar calendar = Calendar.getInstance();
    calendar.setTimeInMillis(milliSeconds);
    System.out.println(formatter.format(calendar.getTime())); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have string as abvd.qweqw.sdfs.a=aqwrwewrwerrew . I need to parse this string and get
I have string like \LESSING\root\cimv2:Win32_UserAccount.Domain=LESSING,Name=Admin How to convert it to LESSING\Admin using Framework?
I have string in which it has Date of type- 'mm-dd-yyyy'; I have to
I have string array which is fetched from an external xml response. This string
I have string object. I need to pass this data to another object of
I have string like this 0 0.014E5 and I need it split into a
I have string in following format 07_Dec_2010, I need to convert it to 07
Have String str May 23 2011 12:20:00, want to convert it to date such
I have String variable which contains date. Now how to display July 15 from
I have string which is storing only 1's and 0's .. now i need

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.