cancel
Showing results for 
Search instead for 
Did you mean: 

Change time format to 24 hours

Former Member
0 Kudos

Dear Experts,

In my webdynpro application I have a requirement where I have to use a 24 hr time format, but by default it is shown as 12 hr format, because of the language in portal.

And I only want to change the format in this application only, not of all the portal.

Please suggest.

Warm Regards,

Upendra Agrawal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Upendra,

For this, In the local dictionary of the application, create a simple data type of built in type Time, and select the represantation format as HH:mm:ss. Create a new context attribute with this data type. Set you context element to this type.

Thanks and Regards,

Shyam.

Former Member
0 Kudos

Dear Shyam,

Thanks for your quick reply, but this data I am getting from backend, which is coming as 12 hr format, I have to change it to 24 hr format.

Warm Regards,

Upendra Agrawal

Former Member
0 Kudos

Hi Upendra,

Assign the value from backend to the newly created attribute of type new simple type. This will convert it to the 24 hrs format

OR

if you get the date from backend,

Try using a date formatter.

String s;

Format formatter;

Date date = // Your date value from the backend.

formatter = new SimpleDateFormat("HH.mm.ss");

s = formatter.format(date);

This will give the time in 24 hrs in the variable 's'.

Pls try this and let me know.

Thanks and Regards,

Shyam.

Edited by: Shyam Gopal on Jul 28, 2010 3:05 PM

Former Member
0 Kudos

The former method worked for me.

Thanks

Upendra Agrawal

Answers (0)