cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Time Entry in Webdynpro application

Former Member
0 Likes
485

Hi,

I am developing a webdynpro application. In this I want a field to contain Date and Time values. I tried by declaring it as Date field. But I am unable to enter time into this. Is there a way to enter both Time and Date.

Please let me know the solution.

Thanks and Regards,

D.NagaSurendra.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi,

Please check this

Regards, Anilkumar

Former Member
0 Likes

Hi Anil,

I am able to get date by using the Caledar. But how to get the time? When I am making a field as DATE, I am able to select the date from the calendar icon that will be placed beside the input field. I want TIME also to be displayed along with the DATE. Please let me know how to do this.

Regards,

D.NagaSurendra.

Former Member
0 Likes

Hi

Create a Simple Types with date type in the Representation tab give the Format like "dd/MM/yyyy HH:mm" and bind it to the input element .

Kind Regads

Mukesh

Answers (2)

Answers (2)

Former Member
0 Likes

Hi Surendra,

The reply given by mukesh is the correct one.

-Anilkumar

Former Member
0 Likes

Hi,

I am using the field from Component Controller. I have set the field as date. But I am not able to set the format to it. Where I need to set the format. Please let me know.

Regards,

D.NagaSurendra.

Former Member
0 Likes

Hi Surendra,

You need to override the default toString() method of java.sql.Date. Use the following code -

Date date = new Date(System.currentTimeMillis())

{

public String toString()

{

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd G HH:mm:ss");

return dateFormat.format(this);

}

};

wdContext.currentConextElement.setMyDate(date);

In a much better way you can use same funtionality in caliculated attribute.

Message was edited by:

Abhilash gampa

Former Member
0 Likes

hi

Surender there is a class in Java as TimeStamp use it as:

Timestamp frmTime = new Timestamp(2006-1900, 10, 13, 19, 0, 0, 0);

Here Date start from 0 and you have to minus 1900 from the year.

Regards

Nidhideep

Former Member
0 Likes

Hi,

Try this

Calendar cal = Calendar.getInstance();

int hour12 = cal.get(Calendar.HOUR);

int hour24 = cal.get(Calendar.HOUR_OF_DAY);

int min = cal.get(Calendar.MINUTE);

int sec = cal.get(Calendar.SECOND);

int ms = cal.get(Calendar.MILLISECOND);

int ampm = cal.get(Calendar.AM_PM);

wdContext.currentContextElement().setTime(hour12+":" +min +":" +sec);

Regards, Anilkumar