cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying date in dd/MM/yyyy format

Former Member
0 Kudos

Hi all,

I am having one date field .To display the date in correct format, I created a dictionary simple type of type date and entered dd/MM/yyyy in representation tab.

I was using 2004 and it was working properly. Now I am using 2004s for the same application. The problem is when I am selecting a date , it is showing the date in MM/dd/yyyy format in first time. If I selects the date again, then it will be in dd/MM/yyyy format. How can I make the selection in dd/MM/yyyy in first time itself

Thanks

Fahad Hamsa

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Does anybody can help me.It is very urgent for me

Thanks

Fahad Hamsa

lajitha_menon
Contributor
0 Kudos

Hi,

can you see whether this error is machine dependent? Does it occur in all the machines?

LM

Former Member
0 Kudos

Hi,

The date is in dd/MM/yyyy format in local settings and selected the regional settings as English(UK).

Thanks

Fahad

Former Member
0 Kudos

Hi satyajit,

Thanks for the reply.I tried your solution, but not working. I found out one more thing. The problem is only for the application that is migrated from 2004 to 2004s.

Can you please give me some other solution for this.

Thanks

Fahad Hamsa

Former Member
0 Kudos

Hi Fahad,

In addition to the code posted earlier, try this.

1. In wdDoInit write this code:


Date currDt = new Date(System.currentTimeMillis());
		
wdContext.currentContextElement().setCustomDate(currDt);

I remember trying this in 04s and it was working.

Regards,

Satyajit.

Former Member
0 Kudos

Hi satyajit,

I did your code and is working.But in my requirement, they needs date field with blank values. ie. no dates needs to be displayed initially.

After setting the date to current date, I tried by setting it to null, then also it is not working properly.

Thanks

Fahad

Former Member
0 Kudos

Hi All,

Any suggestions will be helpful for me

Thanks

Fahad

Former Member
0 Kudos

Hi Fahad,

As a last resort all I can suggest is: in the Definition tab for the simple type set some value in the "Minimum inclusive" property. Set something like "1900-01-01".

If that doesn't work and if you have to stick to the requirement of not displaying any initial dates, then you can always implement your own date picker using the DateNavigator UI control.

Regards,

Satyajit.

Former Member
0 Kudos

Hi Satyajit,

That solution is also not working. If you gets some other solution, please make a reply to this

Thanks for your support

Fahad Hamsa

lajitha_menon
Contributor
0 Kudos

Hi,

can you check the date format in your local machine? See whether it is set to dd/mm/yyyy

regards,LM

Former Member
0 Kudos

Thanks Lohitha. But I didnt get the solution for my problem

Former Member
0 Kudos

Hi,

Try this:

1. Create a simple type in the local dictionary. Call it say, CustomDateType.

2. Set the built-in type as date.

3. Go to the representation tab and under "External Representation" set the format to "dd/MM/yyyy".

4. Create a context value attribute day, CustomDate and set its type to CustomDateType.

5. Create an inputfield with id say, "DateField" and bind its value property to CustomDate.

6. Now in your wdDoModifyView() write the following code:


if(firstTime){
   IWDViewElement e = view.getElement("DateField");
   e.requestFocus();
}

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

use this code

Date date1 = new Date();

SimpleDateFormat fmtDatePlain = new SimpleDateFormat(" dd/MM/yyyy ");

String formattedDate = fmtDatePlain.format(date1);

System.out.println("todaysdate" +formattedDate);

thanks

Lohi.

Former Member
0 Kudos

Hi Lohitha

I can do this if the input field is of type String since it is returning the formatted date as String. But my input field is of type Date.In my requirement, When the user selects a date using the date picker, the date should be displayed in dd/MM/yyyy format.

Thanks for the reply

Fahad Hamsa

Former Member
0 Kudos

Hi,

This link might helps you .

thanks

Lohi.