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

  • Home
  • SEARCH
  • 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 8520067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:25:55+00:00 2026-06-11T06:25:55+00:00

try { Date sysDate = new SimpleDateFormat(dd/mm/yyyy).parse(_sysDate); Date userDate = new SimpleDateFormat(dd/mm/yyyy).parse(_userDate); if (userDate.compareTo(sysDate)

  • 0
try {
            Date sysDate = new SimpleDateFormat("dd/mm/yyyy").parse(_sysDate);
            Date userDate = new SimpleDateFormat("dd/mm/yyyy").parse(_userDate);
            if (userDate.compareTo(sysDate) > 0)
                return false;
                    else 
                            return true;
        } catch (ParseException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

Above is my following code snippet to check two dates which is greater or not.
When I am giving :
sysdate=12/9/2012 and userdate=11/9/2012 or 10/8/2012 or 15/9/2011 it is giving the correct output

But when I am giving :
sysdate=12/9/2012 and userdate=13/8/2012 or 15/7/2012 or 16/6/2012 it is giving incorrect output.
To my analysis I have come to this point if I choose any month between Jan’ 12 to Aug ’12 and select the day_of_month(i.e. 0,1,2,…,31) more than the current day_of_month (in this case 12), I always get an incorrect output.

Please suggest any possible solution.

  • 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-11T06:25:56+00:00Added an answer on June 11, 2026 at 6:25 am

    The problem is the pattern which should be “dd/MM/yyyy” (with capital “MM” for month) instead of “dd/mm/yyyy” (with small “mm” which means minutes).

    So, it should be as follows –

    try {
        DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        Date sysDate = df.parse(_sysDate);  
        Date userDate = df.parse(_userDate);
        //... 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This code: SimpleDateFormat format = new SimpleDateFormat(yyyy-MM-DD_HH-mm-ss); Date date=null; try { date = format.parse(2012-07-04_13-42-03);
please consider the following snippet: SimpleDateFormat parser = new SimpleDateFormat(MMdd); parser.setLenient(false); try { Date
I am getting java.util.concurrentmodificationexception for my implementation below try{ Date fromDate = new Date().parse(yyyy-MM-dd,
Why this code doesn't raise a 'ParseException' ? DateFormat formatter = new SimpleDateFormat(dd/mm/yyyy); try
executing this piece of code: SimpleDateFormat sdfIn = new SimpleDateFormat(yyyy-MM-dd); Date date = null;
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I have this code that formats the date to this pattern dd-MM-yyyy: SimpleDateFormat sdf
I am trying to insert today's date and try increment the date recursively. but
When try to convert string value in date-time format some time string variable comes
I try to get the last modification date of a file: NSFileManager *fm =

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.