cancel
Showing results for 
Search instead for 
Did you mean: 

Changing date format of different computers

Former Member
0 Kudos

Hi Experts,

I have an application which has an input field of type date in selecting a date the default value and format it returns is 2010-08-24 ("yyyy-mm-dd") however in some instance when users tried to run the application others have their format changed to 2010-24-08 ("yyyy-dd-mm") and it causes some issues in regards to checking and parsing the date. The users of the app doesn't want to change their computer settings. is there a way to get the date format of a specific computer?

Glad to have your inputs.

Thanks,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

1) You can override the date settings so they all display the way you expect on all computers.

2) You can change your code so that its not dependent on the string representation of the date.

Option 2) is the better approach as it allows your users to determine how their dates are displayed.

In order to do 1) you can create a Simple Type in the local dictionary, make it a date and specify the format. Then use this simple type as the type for that context element. If you use this approach put it in a common component and expose it via a public part so you can use this one Simple Type for all date representations in your system. And changing it here will change it everywhere.

In order to do 2) you need to use your Date, Timestamp and Calendar objects for one of the functions they were intended to be used for- to "check and parse dates". Use the javadocs to learn how to use them.

http://download.oracle.com/javase/1.4.2/docs/api/java/sql/Timestamp.html

http://download.oracle.com/javase/1.4.2/docs/api/java/util/Date.html

http://download.oracle.com/javase/1.4.2/docs/api/java/util/Calendar.html

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ilan & Poojith,

What I was trying to do is finding a way how to determine the default format of date of a certain computer to know how I'm going to parse the user inputted date however, I did'nt found any solutions for this approach. So I did the simple types, looks like the users haven't encountered any problems with the dates anymore.

Thanks for the response, points given accordingly

Cheers,

former_member214651
Active Contributor
0 Kudos

Hi,

Maintain one format of date representation for all the users, which will be easy to maintain as well. Try the following:

1. Create a new simple type attribute under Dictionaries-->simple type.

2. Select the type as Date.

3. Switch to the Representation tab and enter the format as which ever u need (dd/MM/yyyy, dd.MM.yyyy, etc);

4. Bind the context attribute to the simple type created and use it in the input field to select date.

Regards,

Poojith MV