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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:09:26+00:00 2026-05-23T16:09:26+00:00

I have time stamps as string format Sun Jul 10 17:47:55 EDT 2011 I

  • 0

I have time stamps as string format Sun Jul 10 17:47:55 EDT 2011

I need to determine if the current DAY is greater than the stored day.

I will get the current day with
Date currentDate = new Date();

and I will parse my string into a Date object with SimpleDateFormat dateParser = new SimpleDateParser("E MMM d HH:mm:ss z y");

but using the “currentDate.after()” function, or the currentDate.compare() function will only tell me if ANY date is greater or less than, which includes by the hour,minute or second.

So My next hunch would be to convert the date into the day of the year, and compare the new integers, if integer1>integer2, then.. but how would I do that?

I also considered breaking the string up to a substring consisting of only the first half of the stored string date. Sun Jul 10 to Sun Jul 10 but the problem here is that the day value is sometimes 1 digit and othertimes 2 digits.

Also I think the Calendar abstract class is the best way to go about this, but I am unsure, and currently in a fog about how to convert the Date objects into the Calendar object for comparison!

Insight appreciated

  • 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-23T16:09:26+00:00Added an answer on May 23, 2026 at 4:09 pm

    This may be helpful in your case (as quick way):

    Locale.setDefault(Locale.UK);
    String storedDateString = "Sun Jul 10 17:47:55 EDT 2011";
    SimpleDateFormat dateParser = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
    
    Date storedDate = dateParser.parse(storedDateString);
    
    GregorianCalendar storedCal = new GregorianCalendar();
    storedCal.setTime(storedDate);
    GregorianCalendar currentCal = new GregorianCalendar();
    
    int storedDayOfYear = storedCal.get(Calendar.DAY_OF_YEAR);
    int currentDayofYear = currentCal.get(Calendar.DAY_OF_YEAR);
    
    //int storedDayYear = storedCal.get(Calendar.YEAR);
    //int currentDayYear = storedCal.get(Calendar.YEAR);
    
    System.out.println(storedDayOfYear);
    System.out.println(currentDayofYear);
    
    //System.out.println(storedDayYear);
    //System.out.println(currentDayYear);
    

    Result:

    191
    192
    

    After that it’s trivial to compare int values.

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

Sidebar

Related Questions

I have datetime data in string format like this: Sat Mar 24 23:59:59 GMT
I have this string in serialize format a:6:{s:5:width;i:452;s:6:height;i:336;s:14:hwstring_small;s:23:height='96' width='128';s:4:file;s:20:2012/01/Picture3_410_1325761656.jpg;s:5:sizes;a:8:{s:9:thumbnail;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x160.jpg;s:5:width;i:162;s:6:height;i:160;}s:6:medium;a:3:{s:4:file;s:35:Picture3_410_1325761656-258x191.jpg;s:5:width;i:258;s:6:height;i:191;}s:8:post-top;a:3:{s:4:file;s:35:Picture3_410_1325761656-110x110.jpg;s:5:width;i:110;s:6:height;i:110;}s:9:post-tiny;a:3:{s:4:file;s:35:Picture3_410_1325761656-108x100.jpg;s:5:width;i:108;s:6:height;i:100;}s:9:post-item;a:3:{s:4:file;s:35:Picture3_410_1325761656-452x327.jpg;s:5:width;i:452;s:6:height;i:327;}s:11:post-review;a:3:{s:4:file;s:35:Picture3_410_1325761656-162x166.jpg;s:5:width;i:162;s:6:height;i:166;}s:9:post-poll;a:3:{s:4:file;s:35:Picture3_410_1325761656-285x237.jpg;s:5:width;i:285;s:6:height;i:237;}s:14:post-top-story;a:3:{s:4:file;s:35:Picture3_410_1325761656-300x130.jpg;s:5:width;i:300;s:6:height;i:130;}}s:10:image_meta;a:10:{s:8:aperture;i:0;s:6:credit;s:0:;s:6:camera;s:0:;s:7:caption;s:0:;s:17:created_timestamp;i:0;s:9:copyright;s:0:;s:12:focal_length;i:0;s:3:iso;i:0;s:13:shutter_speed;i:0;s:5:title;s:0:;}} which is used in wordpress
I have a file with data in this format: Name WeekDay Month day, Year
I have a timestamp with timezone information in string format and I would like
I have a string in the format yW. Year followed by the week number.
I have a long string, the format will be same of this string but
I have a time stamp I created with PHP that I would like to
i want to have a time stamp for logs on a Windows Mobile project
I have a mysql table that relies on the unix epoch time stamp equivalent
I have the following entry in my database: t.time :my_time_stamp In my controller I

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.