cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the date format in a HTMLB Input field component

Former Member
0 Kudos

Hi all,

I'm trying to change date format in a HTMLB Input field.

At the moment I have got a format like 30.10.2006 (other users or 10.30.2006 (us users).

I prefer to have an output like 30-Oct-2006.

I haven't found functions to do that.

Is that posible or the format of outputs from Date Navigator are fixed.

Here is code I'm using.

<i>


//InputField
inputField = new InputField("DateInp");
inputField.setType(com.sapportals.htmlb.enum.DataType.DATE);
inputField.setValid(true);
inputField.setShowHelp(true);

</i>

Thank you in advance,

Dimitri Herber

SAP Germany

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

Calendar cal = Calendar.getInstance();

SimpleDateFormat smplDateFormat = new SimpleDateFormat("dd/MMM/yyyy");

String date = smplDateFormat.format(cal.getTime());

String a = (String) date;

response.write(a);

Output: 17/Feb/2006

Refer this thread for more info

/message/317499#317499 [original link is broken]

Former Member
0 Kudos

hi

i would suggest you to write a javascript function that will be activated for example ON_BLUR, to change to the format that you want.

thanks

Former Member
0 Kudos

Hi all,

thanks for the answer.

I can read and format datas on server-side only. But user changes date using datenavigator on client und shuld see at the same the right format in input field -> <b>10-Nov-2006.</b>

I cann't use javascript because the validator of DateNavigator registers an error (wrong format).

Dimitri

Former Member
0 Kudos

Hi Dimitri,

"The "Date" format is controlled by the "locale" settings of your workplace / for the user (when logged in). In the PDK under "Documentation > Portal Services > Internationalization you find details how to set a locale for the workspace and the user."

That documentation tell us the following:

-


The default language is defined in the file workplace.properties, which is located in folder

%IRJ_HOME%\WEB-INF\plugins\portal\system\properties .

Settings in the file workplace.properties:

#

  1. This is the language set

#

request.defaultlanguage=en

request.defaultcountry=us

The settings in the workplace.properties file have control as long as the user is not logged on. For users who are logged on, the language (locale) setting is defined in the file KMUsers.properties, which is located in folder

%IRJ_HOME%\webapps\irj\WEB-INF\plugins\portal\services\usermanagement\data\.

Settings in file KMUsers.properties:

wp.locale = en_us

The default language is set to en (=English) and the default country to us (=USA).

I hope this helps. Let me know if you have any more concerns regarding this

Thanks & Regards

--Vishal Sood

<b>PS: Please reward points for helpful answers</b>

Former Member
0 Kudos

Hi Vishal,

thanks for your help.

My problem is still here - I need a date format like

01-Nov-2006. So I'd like to replace the old form of month with numbers only ( 01.11.2006 -> "11" ) and to give "Nov" out.

Is it posible?

Thanks,

Dimitri

Former Member
0 Kudos

Hi Dimitri,

I tried to look up for the solution, but unfortunately could not find one. Lets hope somebody else in this forum gets a chance to look at your problem and can help you. But I doubt because in my experience in SAP most of the date formats are in the form like mm/dd/yyyy or dd/mm/yyyy in Portal. Lets hope someone is able to help you.

Sorry for being so presemptous about this issue, if it is an important piece for your application and you need it fast, why don't you try just write a small function to convert the date for you the format you want?

Thanks & Regards

--Vishal Sood

<b>PS: Please reward appropriate points for helpful answers</b>