J2EE Architect/Developer
J2EE Architect/Developer
Laxman
Laxman
Originally posted by sony rao:
hi Henrique
i tried what Jesper said..
Date now = new Date();
System.out.println("date--> " + now);
DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
String s = df.format(now);
String result = s.substring(0, 26) + ":" + s.substring(27);
System.out.println("result--> " + result);
output:
date--> Fri Mar 14 10:27:31 IST 2008
result--> 2008-03-14T10:27:31.197+05:0
"2008-03-14T10:27:31.197+05:0" is not the format i want my result to be.
it should be in MM/dd/yyyy hh:mm a format
Pawan Kalyan wrote:I would greatly appreciate if someone posts a solution for this.
And i am trying to get the return type as Date in the format MM/dd/yyyy.
Thanks again.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
W. Joe Smith wrote
No one here will provide you with code to do what you are asking
Pawan Kalyan wrote:
W. Joe Smith wrote
No one here will provide you with code to do what you are asking
i am having a problem with parsing the date using simpledateformatter.
Thats why i have posted and if someone could guide me then that would be really great.
I dont see a point why someone should not help me in giving the syntax or code.
I dont think you will have any problem if someone wants to give the solution.
SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Jesper Young wrote:The "+02:00" is the timezone.
Unfortunately SimpleDateFormat does not have many options to format the time zone. You can use the capital letter 'Z' in the format string to specify the timezone, but this will format it as "+0200" (without the colon). So what you can do is use 'Z' and then insert the colon yourself afterwards:
SCJP 1.5
Looky! I'm being abducted by space aliens! Me and this tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|