473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Date Comparision

kaleeswaran
132 100+
hi !
i would like to Compare a two dates.....which one is grater.so is there any methods to compare the dates.and also i should use SimpleDateformat for formating my date.
give me the solution please.
thank you,
Oct 1 '07 #1
4 1543
JosAH
11,448 Expert 8TB
hi !
i would like to Compare a two dates.....which one is grater.so is there any methods to compare the dates.and also i should use SimpleDateformat for formating my date.
give me the solution please.
thank you,
Have a look at the Calendar and GregorianCalendar classes.

kind regards,

Jos
Oct 1 '07 #2
dmjpro
2,476 2GB
Have a look at the Calendar and GregorianCalendar classes.

kind regards,

Jos

Have a try this.

Expand|Select|Wrap|Line Numbers
  1. Date d1 = new Date();
  2. Date d2 = new Date();
  3. //Here d1 & d2 is different Objects with different time.
  4. System.out.println(d1.after(d2) + d1.before(d2));
  5.  
Good Luck.

Kind regards,
Dmjpro.
Oct 1 '07 #3
JosAH
11,448 Expert 8TB
Have a try this.

Expand|Select|Wrap|Line Numbers
  1. Date d1 = new Date();
  2. Date d2 = new Date();
  3. //Here d1 & d2 is different Objects with different time.
  4. System.out.println(d1.after(d2) + d1.before(d2));
  5.  
Good Luck.

Kind regards,
Dmjpro.
You can't add two booleans and maybe the OP wants to know how many days
are between the two dates.

kind regards,

Jos
Oct 1 '07 #4
dmjpro
2,476 2GB
You can't add two booleans and maybe the OP wants to know how many days
are between the two dates.

kind regards,

Jos
Jos, :-)
Here I mistyped.

And that's different if user wants the difference between two dates :-)

Kind regards,
Dmjpro.
Oct 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Donnal Walter | last post by:
I was very surprised to discover that >>> import datetime >>> x = datetime.date(2004, 9, 14) >>> y = datetime.datetime(2004, 9, 14, 6, 43, 15) >>> print x == y True How can these two...
2
by: Keith Bolton | last post by:
Hello All, I've joined the wxPython list, but this is my first post on the python list and it's good to be here :^) Anyway... My question is relating to Date equality. I am checking if two...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
5
by: JIM.H. | last post by:
Hello, Since I am learning C# now, I might have a simple question, I know my datarow dr keeps datatime and I need to compare it if it is current date, if not how many days ago? How should I...
3
by: kd | last post by:
Hi All, How to perform case-insensitive comparision of strings? Would there be some kind of an indicator, which when set to true, would allow case-insenitive comparision of strings using...
1
by: viswanadhds | last post by:
Hi all, I was trying to compare a date with todays date like this var date1 = getDateObject(document.groupForm.endDate.value); var today = new Date(); today.setHours(0,0,0); if(date1 <...
3
by: abctech | last post by:
I have an Html page, user enters a Date (dd-mm-yyyy) here. There's a servlet connected in the backend for processing this submitted information, it must have a method to compare this entered date...
1
by: srikanthch3 | last post by:
Hi I had problem in comparision of the start date and end date vba in excell.if u give the end date 2/2/07 and start date 3/2/07, it is accepting.so any one can help. Srikanth
1
kaleeswaran
by: kaleeswaran | last post by:
hi! i am doing airways project...so i need to compare my date with my current date and user entry date...so i can format my date by using SimpleDateFormat.but i could not find out how to compare...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I am trying to compare just the time portion of two variables that are of date time part. For example I have dtdate1= 2/2/07 10:00:00 dtdate2=3/4/07 9:00:00 so for the comparision I would...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.