cancel
Showing results for 
Search instead for 
Did you mean: 

Date Search Problem

MG3
Contributor
0 Kudos

Hi

<u><b>Scenario:</b></u>

I have a table that has date, time and string data columns.

I have a search field where the user can enter any string and find a match.

<u><b>Problem:</b></u>

Format of Date displayed in the table: "5/9/2006"

Search String entered by the user: "5/9/2006"

Format of the Date when I use messageManager.reportSuccess to display the

date from the same context attribute: "2006-05-09"

Because of this difference, Im not able to find a match.

<u><b>Limitations:</b></u>

Cannot use SimpleDateFormatter as the format might differ for different countries.

<u><b>Question:</b></u>

How can I solve this problem?

Thanks

oj

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use SimpleDateFormat, because it takes a Locale as one of the parameters to its constructor.


SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());

f.parse("<your date value>");

Regards,

Satyajit.

MG3
Contributor
0 Kudos

Hi Satyajit

Thanks for the help. But client says "NO using date formatters".

Got it thru the getAttributeAsText on the date context attribute which returns the date as a string in the same format displayed in the table and as entered by the user in the search field. This worked.

Thanks

oj

Answers (1)

Answers (1)

Former Member
0 Kudos

oj,

post your code to execute search.

VS