How to convert from Date(10-Oct-2014 00:00:00) to String in Java -


this question has answer here:

i want compare 2 date values in java

date date1=10-oct-2014 00:00:00(value fetched db) date date2=10-oct-2014 00:00:00(value fetched db) 

how convert date values string format in java cant compare them or else there way can compare these dates.

i compare long values of both dates this: if dates nullable dont forgett nullcheck!

if (date1!=null && date2 != null){    if (date1.gettime() == date2.gettime()){       system.out.println("dates equal");    } } 

there no need cast date objects string objects.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -