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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:29:00+00:00 2026-06-14T22:29:00+00:00

I have a string String time = 2012-09-12 15:04:01; I want to parse that

  • 0

I have a string

 String time = "2012-09-12 15:04:01";

I want to parse that string to Joda-Time:

DateTimeFormatter dateStringFormat = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss");
DateTime time = dateStringFormat.parseDateTime(date);

But when I print time

time.toString()

The output is:

2012-09-12T15:04:01.000+03:00

Why output is different from input? What I do wrong? I mean what is ‘T’?? Thanks in advance.

  • 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-14T22:29:02+00:00Added an answer on June 14, 2026 at 10:29 pm

    When you parse a date or number you extra its value, not the format it was as a String.

    When you toString() the value is converts it to a default format.

    Why output is different from input ?

    It would be surprising coincidence if it were the same.

    What I doing wrong?

    Assuming there is only one format of a value.

    I mean what is ‘T’ ?

    It means it is in ISO 8601 format.


    BTW you have the same problem with numbers

    System.out.println(Double.parseDouble("123456789"));
    System.out.println(Double.parseDouble("1.1e2"));
    

    prints

    1.23456789E8
    110.0
    

    In each case the value is correct, but original format is not recorded or preserved.

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

Sidebar

Related Questions

I have a date/time string like 2012-01-13 04:37:20 but I want to convert it
I have a String that represents a time value and is stored in the
I have a service that give me a date time string in the following
I have a RichTextBox that I write a string to every time I click
I want to change the app.setting connection string at the run time. I have
I have a String this:- Tue Oct 30 13:22:58 GMT+05:30 2012; I want to
I have a string similar to 2012-06-14 20:38:24.213-7:00 and want to convert it to
I have string with following format: $date = 2012-07-22 17:48:24; I want to get
I have a String 26/09/2012 07:30:00 is it possible to create a new DateTime
I have a string like 2012-11-08 . I want to convert this string into

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.