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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:14:48+00:00 2026-05-25T14:14:48+00:00

I have a custom formatter… // default our time zone to the machine local

  • 0

I have a custom formatter…

// default our time zone to the machine local one.
private static final DateTimeZone LOCAL_TZ = DateTimeZone.getDefault();

// format of date (i.e., timestamp) is yyyy-MM-dd HH:mm:ss.S
private static final DateTimeFormatter YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_MILLIS_FORMATTER =
        new DateTimeFormatterBuilder()
.appendYear(4,4)
.appendLiteral('-')
.appendMonthOfYear(1)
.appendLiteral('-')
.appendDayOfMonth(1)
.appendLiteral(' ')
.appendHourOfDay(2)
.appendLiteral(':')
.appendMinuteOfDay(1)
.appendLiteral(':')
.appendSecondOfDay(1)
.appendLiteral('.')
.appendMillisOfDay(1)
.toFormatter().withZone(LOCAL_TZ);

I do something like…

String value = "2011-06-21 05:00:00.0";
YEAR_MONTH_DAY_HOUR_MINUTE_SECOND_MILLIS_FORMATTER.parseDateTime(value);

If I look at the org.joda.time.DateTime in a debugger, I will see that the hour:minute:second.millis got converted to 00:00:00.0.

What gives? I’ve tried mucking around with minDigits on HourOfDay, MinuteOfDay, SecondOfDay and so on. Is this a bug in JodaTime 2.0? Or (more likely) my own ignorance?

  • 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-25T14:14:48+00:00Added an answer on May 25, 2026 at 2:14 pm

    You’ve said that it’s 0 millis of the day. In other words, it’s the first millisecond of the day. That obviously conflicts with it being hour 5, and it looks like the last-specified value is taking precedence.

    I suspect you want appendMillisOfSecond – the milliseconds within the already-specified second.

    (Let me know if the difference isn’t clear to you. I’ve recently been writing the parsers and formatters for Noda Time, so I’m coming from a somewhat different perspective to most people…)

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

Sidebar

Related Questions

I have created a custom class which show time date formatter and I need
Im trying to create a custom formatter in Symfony 1.4. I have embedded form
I have created a custom formatter for my (read-only) table column. It looks like
I have a dynamically created jqGrid with a custom formatter. I need to be
I currently have a custom log manager that internally uses java.util.Formatter . The main
I have a jqgrid and I have a custom formatter for it which formats
I have created a custom component (NumberFormattedTextField) of JFormattedTextField. This is the Formatter I
We have a grid with datatype json. We have the following custom formatter: function
I have a listbox that displays Shipment Items (custom class) that are formatted using
I have custom coded several enterprise applications for mid to large organizations to use

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.