on 07-24-2006 9:30 AM
hi,
I am getting the date in the format mm/dd/yyyy
but i want to get it in the format yyyyddmm without extra characters
Waiting for a positive reply
with regards,
kiruthika.s
hai,
create a simple type of type date, select the tab reperesentATION, HERE YOU CAN GIVE FORMAT yyyyddMM .
bind this attribute to input field.
the date will taken in this format.
regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Prabhu,
SimpleDateFormat fmtDateDelim = new SimpleDateFormat("MM/dd/yyyy");
Date parsedDate = fmtDateDelim.parse("07/24/2006");
SimpleDateFormat fmtDatePlain = new SimpleDateFormat("yyyyMMdd");
String formattedDate = fmtDatePlain.format(parsedDate);
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This code below will convert the date format but change the code to ur format what u need.
then u can use String tokanizer to separate the "/".
And combine the date.
String oldFormatData = "2006/07/17";
String newFormatData;
SimpleDateFormat old = new SimpleDateFormat("yyyy/MM/dd");
SimpleDateFormat new1 = new SimpleDateFormat("dd/MM/yyyy");
Date old1 =null;
try {
old1= old.parse(oldFormatData);
} catch (ParseException e) {
wdComponentAPI.getMessageManager().reportException(""+e,true);
}
newFormatData = new1.format(old1);
wdComponentAPI.getMessageManager().reportSuccess("Date"+newFormatData);
Regards.
Vijayakhanna Raman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check this code,
String oldFormatData = "24/07/2006";
String newFormatData;
SimpleDateFormat new1= new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat old = new SimpleDateFormat("dd/MM/yyyy");
Date old1 =null;
try {
old1= old.parse(oldFormatData);
} catch (ParseException e) {
wdComponentAPI.getMessageManager().reportException(""+e,true);
}
newFormatData = new1.format(old1);
Regards,
Vijayakhanna Raman
HI you can use this,
First you can convert the date to String.
String chDate=String.valueOf(Date ) int yy=Integer.parseInt(chDate.substring(0,chDate.indexOf("-")));
String balda=chDate.substring(chDate.indexOf("-")+1);
int mm=Integer.parseInt(balda.substring(0,balda.indexOf("-")));
int dd=Integer.parseInt(balda.substring(balda.indexOf("-")+1));
String date=yyyyddmm
P.s:I use the delimeter - You can use the delimeter you get in date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Saravanan,
Don't reinvent the wheel -- http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
VS
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.