0

Why datebox value is not formating ? [closed]

asked 2013-06-07 17:17:08 +0800

jhusson gravatar image jhusson
19 2

I use format properties to get a date like this dd/MM/yyyy

But when i use myDateBox.getValue() the function return a String like this 'Jun 11, 2013 12:00:00 AM'

How to get the format value (12/06/2013) ???

Thanks,

j.

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by sjoshi
close date 2013-06-10 12:03:31

Comments

How you bind your datebox with java code can you post that code?

sjoshi ( 2013-06-07 18:57:39 +0800 )edit

via a Button's 'OnClick Event'

jhusson ( 2013-06-08 11:05:45 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-06-10 02:51:12 +0800

cor3000 gravatar image cor3000
6280 2 7

You can bind the <datebox>' value attribute directly to a member in your ViewModel (which can be also of type Timestamp) see the this example. I do the formatting on the server side using java.text.DateFormat, and on the client side with the format attribute of <datebox>. If this does not help, feel free to update the example and post the updated version here to show problems you encounter.

link publish delete flag offensive edit

Comments

+1 for your example i want to say same thing

sjoshi ( 2013-06-10 06:49:10 +0800 )edit

cor3000 > Thx you guy ! java.text.DateFormat resolve my problem.

jhusson ( 2013-06-10 11:28:51 +0800 )edit
0

answered 2013-06-08 11:08:08 +0800

jhusson gravatar image jhusson
19 2

via a Button's 'OnClick Event'

zul :

<button label="Execute Model"
            onClick="@command('generateReport', date1=db1, date2=db2.value, intervalle=interval.selectedItem.id, typedate=rg.selectedItem.label)" />

java MVVM :

@Command
public void generateReport(@BindingParam("date1") Datebox date1,
        @BindingParam("date2") String date2,
        @BindingParam("intervalle") String interval,
        @BindingParam("typedate") String typedate) {
    System.out.println(date1.getValue() + " / " + date2 + " / " + interval + " / "
            + typedate);
link publish delete flag offensive edit

Comments

Bind it With Timestamp not with String

sjoshi ( 2013-06-08 15:49:43 +0800 )edit

sjoshi thanks for helping, but getValue() return a java.util.date. i cant easily cast it in a Timestamp.

jhusson ( 2013-06-09 12:23:44 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-06-07 17:17:08 +0800

Seen: 27 times

Last updated: Jun 10 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More