You are looking at Format and Date wrongly.
You are looking at Format and Date wrongly. Date does not contain format. Date is just a class containing date info like date, month, hours, sec etc.SimpleDateFormat is the one which tells you the string representation of Date.
But there is no date associated with it. So the idea is when you have to display date or have to store date in some string representation, you will use SimpleDateFormat and pass it the date you want string representation for. One benefit of doing this way is that, I can use same Date object and can show two different string representations (using two different instances of SimpleDateFormat).
And also viceversa, having defined one SimpleDateFormat instance, I can format multiple dates. Edit: Now if you want to strip some info from the date. Use Calendar rightNow = Calendar.getInstance(); Calendar cal = new GregorianCalendar( rightNow.
Get(YEAR), rightNow. Get(MONTH), rightNow. Get(DAY_OF_MONTH)); Date now = cal.getTime(); There are other good soln like JodaTime Ref: GregorianCalendar Calendar Joda Time.
1 For example the statement: Date today = new Date("12/12/2011"); Today doesn't have information about things like time zone, hours, minutes, seconds etc. This is what I mean by format. I am currently getting a Date Object but I want some of the data (like seconds) to be dropped off before I send it. – Boundless Jan 2 at 18:17.
I think what you are trying to achieve does not make sense. A Date object represents time. You can not format it.
But, you can get it's string representation in certain format. Like with myFormat. Format(today).
I think you're misunderstanding something here about what the Date object is. Date simply holds the information about a point in time - it doesn't have a format at all. When it comes to the String representation of a Date, this is where formatting comes into play.
Only worry about the formatting when you are: Parsing a String representation into a Date object. Converting a Date back into String representation to display it in a certain way.
Your question doesn't make sense. Formatting a date by definition means converting it to a string using a specific format. The Date object can stay as a Date object.It is only at the point where you wish to convert it to a String that you need to do any formatting.
Well the interface that I am using needs to have a Date Object sent to it. The Date Object needs to be formatted a certain way (like not having seconds attached to it). Can you suggest a way in which I can do this?
– Boundless Jan 2 at 18:07 That is not formatting, strictly speaking. That sounds more like limiting the precision of the Date, for example by ensuring the time component always has a fixed value of 00:00:00. – bobbymcr Jan 2 at 18:17.
You cannot associate a format to a Date object instead you can only apply the formats while displaying or other activities,, Do all processing in the Date object itself and while displaying alone change to the required format.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.