Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7910247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:47:57+00:00 2026-06-03T12:47:57+00:00

Hi have Date in a string Format. datevalue= [Tue Mar 06 06:00:00 CET 2012].

  • 0

Hi have Date in a string Format.

datevalue= [Tue Mar 06 06:00:00 CET 2012].

in my code i have textBox where value is set.
when i click on textbox i see a datepicker.

what i want to do is , In a datepicker the date should be highlighted whatever the value is in textbox.

and also when i click datePicker the value in the text should be in a same format as
[Tue Mar 06 06:00:00 CET 2012].

my code is.

private TextBox getTimeLable(String datevalue) {
        // TODO Auto-generated method stub
        System.out.println("date" + datevalue);
        final TextBox   timebx =new TextBox();
        timebx.setReadOnly(true);
        timebx.setText(datevalue);
        final PopupPanel popupPanel=new PopupPanel(true);
        DatePicker datePicker=new DatePicker();
        datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {

            public void onValueChange(ValueChangeEvent<Date> event) {
                // TODO Auto-generated method stub

                Date date=event.getValue();
                timebx.setText(DateTimeFormat.getFormat("yyyy-MM-dd").format(date));
                popupPanel.hide();
            }
        });
        popupPanel.setWidget(datePicker);
        timebx.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                // TODO Auto-generated method stub
                int x=timebx.getAbsoluteLeft();
                int y=timebx.getAbsoluteTop();
                popupPanel.setPopupPosition(x, y+20);
                popupPanel.show();
            }
        });

        return timebx;
    }

edited for error

errorjava.lang.IllegalArgumentException: [Tue Mar 06 05:00:00 UTC 2012]

errorjava.lang.IllegalArgumentException: [Wed May 09 12:00:00 UTC+2 2012]

Initially the textbox is with this value [Tue Mar 06 05:00:00 UTC 2012] .
but when i click on text box n select the date . date picker gives the second date in textbox Wed May 09 12:00:00 UTC+2 2012. The first one may be illegalArgument as it is set by me. but the second one is set by the date picker.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:48:01+00:00Added an answer on June 3, 2026 at 12:48 pm

    This should work

    import com.google.gwt.i18n.client.DateTimeFormat; 
    
    DatePicker datePicker=new DatePicker();  // Have to make final to use in inner method
    
    
    timebx.addClickHandler(new ClickHandler() {
    
            public void onClick(ClickEvent event) {
                // TODO Auto-generated method stub
                String strDate = timebx.getText();
                DateTimeFormat format = DateTimeFormat.getFormat("yyyy-MM-dd");
                try {  
                  Date selDate = (Date)format.parse(strDate); 
                  datePicker.setValue(selDate, true);
                } catch(Exception pe){
                 // setting current date
                 datePicker.setValue(new Date(), true);
                }
    
                int x=timebx.getAbsoluteLeft();
                int y=timebx.getAbsoluteTop();
                popupPanel.setPopupPosition(x, y+20);
                popupPanel.show();
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a date in this string format 02/28/2012 and I want to convert
I have date time information in this format: String reportDate=2012-04-19 12:32:24; I want to
Hi I have the following date as String format. Input 2010-04-20 05:34:58.0 Output I
I'm a little blockheaded right now… I have a date string in european format
i want to format date to string in hql select, for example i have
I have a string containing a date, and another string containing the date format
I am have a string named begin_date which contain date in the format dd.mm.yyyy
I have a date string in format 08/1999 I want to get the first
I have the date format string dd-mm-yy. Please can you tell me how to
I have a date in the string format in a table and I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.