• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert string  RSS feed

 
Nimish Patel
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
have a good day....

now i have a one string like "10/12/2005 12:00".
i want to convert this string to like "10-DEC-2005 12:00".

how can i do that.please give some code.

please help me.

i m waiting ur reply.

thanks,
Nimish Patel
 
Ta Ri Ki Sun
Ranch Hand
Posts: 442
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nimish Patel:

how can i do that.please give some code.


Will a hint do?
Browse your API for DateFormat and SimpleDateFormat.

I just checked, the code is actually in DateFormat, they have an example.
 
Steve Morrow
Ranch Hand
Posts: 657
Clojure Spring VI Editor
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone on my team did a conversion like this with a DateFormat parse to Date and another DateFormat back to String. For grins I tested an alternative using substrings and concatenation and it ran 50-100 times as fast. The DateFormat solution is arguably a better and more expressive design, but if you have to do a million of them while the user waits, try substringing with a map or array to get the month name.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!