Friends .. Iam having JSP form s and Iam having a field which contains That this is for this Month means January or feb .. I want to take this date using system date so that user should not fill wrong one ...It can come by default..that i know Select sysdate from dual..but the format I want is for monthly .. So pls tell me the way possible..Iam also trying ..that is something related to SQL decoding ..I guess.. bye and take care sandeep
Want to do something great will do one day
posted 14 years ago
Sandeep, There are so many ways you can do that.
1) <% Calendar cal = new GregorianCalendar(); cal.setTime( new java.util.Date() ); int curMon = 1+cal.get(Calendar.MONTH); /* it will give the value from 1 to 12 and then in the text field you can assign this val as default %> 2) if u r happy to use sql query then use select to_char(sysdate,'mm') from dual; This will give values like '01' to '12'. But I will recommend to use the first option. Cheers, Nikhil