cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get date in yyyy.MM.dd format

Former Member
0 Kudos

Hi All

I am unable to get date in yyyy.MM.dd format.

I tried everything said in the previous postiongs.Nothig seem to work.

I am getting date in yyyy-MM-dd

This needs to be changed in said format. Also datatype should be date only.

Regards

Pratyush

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can solve the problem in two ways

First way;

Format formatter = new SimpleDateFormat("yyyy.MM.dd");

String s = formatter.format(date);

OR

Assuming your context attribute name is Date

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute("Date");

attributeInfo.getDataAttribute().getScalarType().format("yyyy.MM.dd");

Second way;

By changing the default Language of your browser. You have to check the format of each language and choose the language that gives the date in yyyy.MM.dd format.

Rgs,

Dni

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanks all for reply.

Actually I tried both it did not worked.

simple type should work but it didnt.

Also since I need data in date format only.

parse cant be used. Since string converted back had different format.

I requested people to make appropiate change in RFC.

It works now.

Regards

Pratyush

Former Member
0 Kudos

hi,

use this

Format formatter = new SimpleDateFormat("yyyy.MM.dd");

Calendar cal= Calendar.getInstance();

String s = formatter.format(cal.getTime());

System.out.println(s);

Regards

Trilochan

srinivas_sistu
Active Contributor
0 Kudos

Hi Pratyush,

Use this...

Format formatter = new SimpleDateFormat("yyyy.MM.dd");

String s = formatter.format(date);

Regards,

Srinivas.

Former Member
0 Kudos

Pratyush,

Create a Simple Type in Dictionary with "Build-In Type" as "date". Goto the tab "Representation" and enter "yyyy.MM.dd" for "Format". Use this datatype for your context variable. When this variable is displayed, it will be in required format.

Cheers,

~kranthi