on 08-11-2006 9:51 AM
Hi
I have a value attribute or type date when i convert it to string it returns me some wrong value follwoing is the code from which i am converting it to string
wdContext.currentContextElement().setTEST(wdContext.currentContextElement().getFrmDateValue()+"");
wdContext.currentContextElement().setTEST(wdContext.currentContextElement().getFrmDateValue().toString());
can any one tell me what could be the problem and how i should convert it to String
Thanks
Ninad
Hi,
Try this out
SimpleDateformat dateform = new SimpleDateformat("yyyyMMdd");
String x = dateform.format(new Date(wdContext.currentContextElement().getFrmDateValue()));
wdContext.currentContextElement().setTEST(x);
-Rathna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes i am useing I gess this might be the problem of time zone as i am storing only date in that case the time will be 00:00:00 and the time zone for our server is +1:00 so when it converts the date is it considering the time zone and converting it to GMT could this be the problem.
This is what come to my mind but it looks very funy and irrelevent.
Thanks
Ninad
Hi,
You can use a code like this:
SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
String formattedDate = df.format(wdContext.currentContextElement().getFrmDateValue());
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are many ways to format a date, see class java.text.DateFormat and its subclass SimpleDateFormat.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.