Code
public String testDate(){
TimeZone.setDefault(TimeZone.getTimeZone(\"US/Eastern\"));
Calendar fromDate = Calendar.getInstance(
You mention "cdate", and I notice there is a field inside the Calendar object called cdate
. In running your sample code, I see that the cdate
field is indeed initialized to 2013-12-10T00:00:00.000Z
(it now being 24 hours later of course).
So? I don't know why you are looking at internal fields of a class when you are never going to directly use them.
Your solution, then, is to ignore it. Don't worry about the cdate
field of your Calendar; worry about things that actually affect your program.
The toString()
of a Calendar
is not very pretty and is intended for debugging; you should call cal.getTime()
which will give you a java.util.Date
that you can then print out either directly or by using a java.text.DateFormatter
.