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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:13:13+00:00 2026-05-15T15:13:13+00:00

I Have Date, that comes to our system in format +0yyyyMMdd For instance 12

  • 0

I Have Date, that comes to our system in format +0yyyyMMdd

For instance 12 March,2011 is +020110312

For now it’s definitely + symbol and one 0 before Date, but in future it may be more than one zeros,e.g. +000020110312

Is it possible to parse it with standard Java java.text.DateFormat.parse(String source)?

Or I should write custom parsing method?

Thank you.

  • 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-15T15:13:13+00:00Added an answer on May 15, 2026 at 3:13 pm

    If the +0 prefix is a constant, then you can just quote it using singlequotes.

    String string = "+020110312";
    Date date = new SimpleDateFormat("'+0'yyyyMMdd").parse(string);
    System.out.println(date); // Sat Mar 12 00:00:00 GMT-04:00 2011
    

    (outcome is correct as per my timezone)

    Note that months are represented by MM not mm. The mm represents minutes. Using mm for months would corrupt the parsing outcome.

    See also:

    • SimpleDateFormat javadoc

    Update: since that seem to vary in the future "but in future it may be more than one zeros", you can better consider to substring the last 8 characters.

    String string = "+020110312";
    Date date = new SimpleDateFormat("yyyyMMdd").parse(string.substring(string.length() - 8));
    System.out.println(date); // Sat Mar 12 00:00:00 GMT-04:00 2011
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a date that comes from a MySQL database in the datetime format,
I'm using .NET 3.5 and I have a date that comes in as string
Let's say I have a date that I can represent in a culture-invariant format
I have a date and I would like to format the date like that:
I have been passed a date string that looks like this: Thu%20Mar%2011%202010%2015%3A09%3A11%20GMT%2B0000%20(BST) I want
I have a Date format: 2009-08-10T16:03:03Z that I want to convert to: @MMM dd,
I have a report in our internal system that can return anywhere from 1
I have a DATE column that I want to round to the next-lower 10
I have a current Date object that needs to be incremented by one day
I have a date and a time that I'm attempting to combine in Python.

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.