Hey guys
How can I get a month as "FEB" in java???
I know I can get the current date by
Date today1 = new Date();
and then get the current month using
int thisMonth = today1.getMonth()+1;
but this returns a number like "2" for Feb.
Is there anyway to retrieve a string like "FEB" instead of 2. Or there any function to convert them rather them having to hardcode with if and else's
What I really want to do is that I have a date in format (15-2-2006) and I want to convert it to (15-FEB-2006). How do i do this. I tried using SimpleDateFormatter like this
SimpleDateFormat format1 = new SimpleDateFormat("dd-MMM-yyyy");
java.util.Date dte = new java.util.Date(format1.parse(today1).getTime());
but it says that it cannot parse 15-2-2006
any thoughts
Thanks
How can I get a month as "FEB" in java???
I know I can get the current date by
Date today1 = new Date();
and then get the current month using
int thisMonth = today1.getMonth()+1;
but this returns a number like "2" for Feb.
Is there anyway to retrieve a string like "FEB" instead of 2. Or there any function to convert them rather them having to hardcode with if and else's
What I really want to do is that I have a date in format (15-2-2006) and I want to convert it to (15-FEB-2006). How do i do this. I tried using SimpleDateFormatter like this
SimpleDateFormat format1 = new SimpleDateFormat("dd-MMM-yyyy");
java.util.Date dte = new java.util.Date(format1.parse(today1).getTime());
but it says that it cannot parse 15-2-2006
any thoughts
Thanks