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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:52:36+00:00 2026-06-07T04:52:36+00:00

I am stuck with this example running on Android: SimpleDateFormat sdf = new SimpleDateFormat(dd-mm-yyyy

  • 0

I am stuck with this example running on Android:

SimpleDateFormat sdf = new SimpleDateFormat("dd-mm-yyyy kkmm"); 
sdf.setTimeZone(TimeZone.getTimeZone(Time.TIMEZONE_UTC));

Date scheduledDateTime = sdf.parse(sms.getScheduledDateTime());

Log.i(TAG, "scheduledDateTime is : " + scheduledDateTime);    // scheduledDateTime is : Fri Jan 06 23:58:00 HNEC 2012
Log.i(TAG, "scheduledDateTime milli : " + scheduledDateTime.getTime());    // scheduledDateTime milli : 1325890680000

Calendar calendar = Calendar.getInstance();
Calendar defaultTZCalendar = Calendar.getInstance(TimeZone.getDefault());
Calendar utcTZCalendar = Calendar.getInstance(TimeZone.getTimeZone(Time.TIMEZONE_UTC));

calendar.setTime(scheduledDateTime);
defaultTZCalendar.setTime(scheduledDateTime);
utcTZCalendar.setTime(scheduledDateTime);

Log.i(TAG, "calendar : " + calendar.getTimeInMillis());    // calendar : 1325890680000
Log.i(TAG, "defaultTZCalendar : " + defaultTZCalendar.getTimeInMillis());    // defaultTZCalendar : 1325890680000
Log.i(TAG, "utcTZCalendar : " + utcTZCalendar.getTimeInMillis());    // utcTZCalendar : 1325890680000

And now look at this:

final long currentTimeMillis = System.currentTimeMillis();
Log.i(TAG, "  currentTimeMillis is " + currentTimeMillis);    //  currentTimeMillis is 1341608182431
Date d = new Date(currentTimeMillis);
Log.i(TAG, "  currentTimeMillis is " + d + " ::: d.getTime() = " + d.getTime());    // currentTimeMillis is Fri Jul 06 22:56:22 HAEC 2012 ::: d.getTime() = 1341608182431

How is possible to have such a difference of 15713902431 between two date that looks the same : Fri Jan 06 23:58:00 HNEC 2012 and Fri Jul 06 22:56:22 HAEC 2012

BTW,

HNEC is (in french) Normal Central Europ time

HAEC is Advanced Central Europ time (which is DST)

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-07T04:52:37+00:00Added an answer on June 7, 2026 at 4:52 am

    All looks fine to me at the end part. The dates don’t “look the same”. One is in July, the other is January. So 15713902431 milliseconds – nearly 182 days – seems entirely reasonable.

    Now as for why your data isn’t parsing correctly – your format is broken:

    new SimpleDateFormat("dd-mm-yyyy kkmm"); 
    

    Note the “mm” between “dd” and “yyyy”. mm is minutes, not months.

    I strongly suspect you should be using:

    new SimpleDateFormat("dd-MM-yyyy kkmm"); 
    

    Then you might get values in the right month 🙂

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

Sidebar

Related Questions

I am stuck with this issue for a long time. I searched for this
I've been stuck on this for hours, first time post. I Don't know how
I'm stuck with this problem for the last 2 days: I have server running
I'm playing with one stack overflow example. This example looks like this: void return_input
My current solution will suck sometimes EDIT For those who don't understand,see this example:
I have google'd it, and tried some examples, but I always get stuck. This
I've come a bit stuck this afternoon with a bug in my web application
Been stuck on this for ages. Currently learning Django and done some bits on
Im stuck with this little project in C# but basically my problem is this:
I have been stuck on this for a while now and I cannot seem

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.