cancel
Showing results for 
Search instead for 
Did you mean: 

time mask to input field

Former Member
0 Kudos

Hi masters!

I have an input field for a Time attribute but this input field is displayed with this mask: 1:01:00.

So what should I do to change this mask to 01:01 ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You could create a custom DDIC type based on "time" and assign your wanted format to it.

Armin

Former Member
0 Kudos

tks

do you have an example ?

Former Member
0 Kudos

You mean a coding example? No I haven't. I would do that using the DDIC editor in the IDE.

Armin

Answers (1)

Answers (1)

lokesh_kamana
Active Contributor
0 Kudos

Hi,

Try this code it will do the work for you.

My context attribute is of type "time" and it is binded to the input field.


	Format formatter = new SimpleDateFormat("h:mm"); 
	String newtim =formatter.format(wdContext.currentContextElement().getTime());
	wdComponentAPI.getMessageManager().reportSuccess(""+newtim);

Result:-

11:30:00--->before

11:30---->After

Note:-

If you want AM or PM Change the first line code as follows.


Format formatter = new SimpleDateFormat("h:mm a"); 

Thanks & Regards,

Lokesh