java - Android - Change SimpleDateFormat template -
New enough for Android / Java language; Lots of experience with Obj-c
Is it possible to change the initial template given to the simplest format, so that you do not need to create a new event every time you need to change it?
I ask because it is something that is done to be able to do it in obj-c. I have seen the documents for a simple document and did not see anything there, but thought I'll check here two times.
An example of what I am trying to achieve:
// * I have left the attempt / simplification for simplification SimpleDateFormat sdf = New SimpleDateFormat ("Yyyy-dd-MM"); Sdf.parse (someDateObj); If (someDateObj == faucet) {// * setTemplate is not real, // * Example of what I'm trying to do ... sdf.setTemplate ("MM-dd-yyyy"); Sdf.parse (someDateObj); }
Is such a thing possible? thank you in advanced.
You can use to provide a new pattern.
Example:
SimpleDetermutation SDF = New SimpleDateform ("YYA-MM-DD"); Println (sdf.parse ("2014-10-17")); Sdf.applyPattern ("MM-dd-yyyy"); Println (sdf.parse ("2014/10/17"));
Output:
Friday Oct 17th 00:00:00 PDT 2014 Venus Oct 17th 00:00:00 PDT 2014
this method also.
Comments
Post a Comment