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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:56:38+00:00 2026-05-29T20:56:38+00:00

I have a class file where the date field has value like 1329242400. This

  • 0

I have a class file where the date field has value like “1329242400”. This value in UI is represented as “0 day 00:02:56”.
I tried below but I get date in 1970’s.

String attr = "1329242400";
Date cDate = new Date(Long.parseLong(attr));

Output is “Fri Jan 16 04:16:55 EST 1970”

Tried below,

GregorianCalendar c = new GregorianCalendar();
c.setTime(cDate);
XMLGregorianCalendar dDt = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);

Output is “1970-01-16T04:16:55.200-05:00”

What other conversion method should I do to get “0 day 00:02:56” or like “Tue Feb 14 00:02:56 EST 2011”?

  • 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-29T20:56:40+00:00Added an answer on May 29, 2026 at 8:56 pm

    The constructor expects the time stamp to be in milliseconds, so you’re off by 3 orders of magnitude:

    Date cDate = new Date(Long.parseLong(attr) * 1000);
                                               ^^^^^^
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a class Car defined like this in a car.rb file class Car
I have a C++ class implementation file which has some constants. The constants appear
I have a data structure which is as given below: class File { public
I currently have a class file with the following enumeration: using System; namespace Helper
I have a function in a class file called auth_user and its in App_code
i have a really basic java program just one .java/.class file (.java uncompiled .class
I started creating file downloader class. Here is what i have: public class Downloader
I have a class which loads an xml file using the following: Path.Combine( AppDomain.CurrentDomain.BaseDirectory,
I have a class that creates a file. I am now doing integration tests
I have a class that occasionally gets passed null for File objects. During normal

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.