date time picker

date time picker

I have enetered a date time picker in my jsp file. there is text field before the date time picker. What should i do so that whenever i click on that text field I am not able to eneter anythng and automatically the date time picker gets opened??

View Answers

June 1, 2011 at 11:29 AM

1)datepicker.html:

<html>
<script type="text/javascript">
function SelectDate(){
    D = document.getElementById('Date').value;
    if(D){
        D = D.split('/');
    }else{
        Dat = new Date();
        D = new Array(Dat.getDay(), Dat.getMonth(), Dat.getFullYear());
    }
    win = window.open("pickmonth.html","win","status=no,scrollbars=no,toolbar=no,menubar=no,height=190,width=160");
    win.MakeDate(D[2], D[1], D[0]);
}
function SetDate(Day, Month, Year){
    document.getElementById('Date').value = Day + '/' + Month + '/' + Year;
}
</script>
<body>
<form name="DateTest">
<input type="text" name="Date" id="Date" readonly><input type="button" onClick="SelectDate()" value="Select"><br>
</form>
</body>
</html>

June 1, 2011 at 11:29 AM

continue..

2)pickmonth.html:

<html>
<head>
<title>Date Picker</title>
<script type="text/javascript">
ReturnFunc = '';
function Calendar(iYear, iMonth, iDay, ContainerId, ClassName){
    MonthNames = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
    oDate = new Date();
    Year = (iYear == null) ? oDate.getFullYear() : iYear;
    Month = (iMonth == null) ? oDate.getMonth() : iMonth - 1;
    while(Month < 0){Month += 12;Year--}
    while(Month >= 12){Month -= 12;Year++}
    Day = (iDay == null) ? 0 : iDay;
    oDate = new Date(Year, Month, 1);
    NextMonth = new Date(Year, Month + 1, 1);
    WeekStart = oDate.getDay();
    MonthDays = Math.round((NextMonth.getTime() - oDate.getTime()) / 86400000) + 1;
    if(ContainerId != null){
        ContainerId = ContainerId;
        Container = document.getElementById(ContainerId);
        if(!Container)
            document.write('<div id="' + ContainerId + '">&nbsp;</div>');
    }
    else{
        do{
            ContainerId = 'tblCalendar' + Math.round(Math.random() * 1000);
        }
        while(document.getElementById(ContainerId));
        document.write('<div id="' + ContainerId + '">&nbsp;</div>');
    }
    Container = document.getElementById(ContainerId);
    ClassName = (ClassName == null) ? 'tblCalendar' : ClassName;
    HTML = '<table border=1>';
    HTML += '<tr bgcolor="red"><td ></td><td colspan="5" class="Title">' + MonthNames[Month] + ' ' + Year + '</td><td ></td></tr>';
    HTML += '<tr ><td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td></tr>';
    HTML += '<tr>';
    for(DayCounter = 0; DayCounter < WeekStart; DayCounter++){
        HTML += '<td>&nbsp;</td>';
    }
    for(DayCounter = 1; DayCounter < MonthDays; DayCounter++){
        if((DayCounter + WeekStart) % 7 == 1) HTML += '<tr class="Days">';
        if(DayCounter == Day)
            HTML += '<td ><a href="javascript:ReturnDate(' + DayCounter + ')">' + DayCounter + '</a></td>';
        else HTML += '<td><a href="javascript:ReturnDate(' + DayCounter + ')">' + DayCounter + '</a></td>';
        if((DayCounter + WeekStart) % 7 == 0) HTML += '</tr>';
    }
    for(j = (42 - (MonthDays + WeekStart)), DayCounter = 0; DayCounter <= j; DayCounter++){
        HTML += '<td>&nbsp;</td>';
        if((j - DayCounter) % 7 == 0) HTML += '</tr>';
    }
    HTML += '</table>';
    Container.innerHTML = HTML;
    return ContainerId;
}
function ReturnDate(Day){
    opener.SetDate(Day, Month+1, Year);
    window.close();
}
function MakeDate(iYear, iMonth, iDay, fn){
    D = new Date();
    Year = (typeof(iYear) != 'undefined') ? iYear : D.getFullYear();
    Month = (typeof(iMonth) != 'undefined') ? iMonth : D.getMonth();
    Day = (typeof(iDay) != 'undefined') ? iDay : D.getDate();
    ReturnFunc = fn;
    id = Calendar(Year, Month+1, Day, 'cal', 'CalendarRed');
}
</script>
</head>
<body onLoad="MakeDate();">
<div id='cal'> </div>
</body>
</html>









Related Tutorials/Questions & Answers:
date time picker
date time picker  I have enetered a date time picker in my jsp file. there is text field before the date time picker. What should i do so... the date time picker gets opened
Date Picker
Date Picker   Hi Java Developers ! I came across the coding for date picker in this site which was almost similar to the coding done by our team... in the calendar( by using date picker ) it needs to get updated/highlighted
Advertisements
Date picker in Java Swing
Date picker in Java Swing  Hello Sir, Sir ,I am in need of Time Picker just like the Date picker available in java Swing. Kindly... link: Java Date Time Picker Example   Hello Sir, Thank
Date Picker
Date Picker  "I want to set default calendar date when using datepicker. This date means auto-loaded date when the calendar appears. The default date is the current date. I want to change it. How could I do
date picker
date picker  where i have to kept javascript ,css files and images in eclipse... please tell me the location
iPhone Date Picker
to show the date which you select on the iPhone date picker with time. The Date...iPhone Date Picker In this tutorial will learn how to use iPhone Date Picker... and to check the attributes for the Date Picker select the Date Picker and then click
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Date & Time
Date & Time  How to insert System Date & Time in MS-ACCESS using Java
Date limit on Dojo Date picker - Date Calendar
picker in my project. When user click on date text box, date picker will pop up... want to Date limit for date picker i.e. If i given date limit from 31/03/2008... this validation by getting value from date picker text box or server side also, but I
date picker - Java Beginners
date picker  sir i need code for date picker in java swing because for Embedding in my project plz sir
javascript date picker - Date Calendar
javascript date picker  how to insert a date picker user control in a html/jsp using javascript??? please help, it's urgent.  Hi Friend, Please visit the following links: http://www.roseindia.net/javascript
date picker componnt - Java Beginners
date picker componnt  sir i need code for date picker in java swing for my project sir please send me sir
How to make Time picker in Java Swing
How to make Time picker in Java Swing  Hello Sir, Thank u so much for such a quick reply . I followed date picker tutorial and completed. but sir i want time picker just like date picker in which we can select hours
How to make Time picker in Java Swing
How to make Time picker in Java Swing  Hello Sir, Thank u so much for such a quick reply . I followed date picker tutorial and completed. but sir i want time picker just like date picker in which we can select hours
How to use Date Picker iPhone
How to use Date Picker iPhone  Hi, I am beginner in mobile Application platform. I want to develop a small application in iphone platform to Show current date and display alert view message. So, how to define the date picker
convert date time to int
convert date time to int  convert date time to int
get date picker values to a textbox
get date picker values to a textbox  I am using DatePicker to select date in a form in asp.net using c#. I need the picked data to get in to a textbox. Please help me soon
Dyanmically Adding Rows with Date Picker
Dyanmically Adding Rows with Date Picker  Hi Sir, I am doing a project in that i need to add rows dynamically with date picker inside row, send me code as soon as possible. Regards, Santhosh
jquery date picker
jquery date picker  how can i compare the dates on click from a calendar with the dates that are stored in database
JTable with Date Picker
JTable with Date Picker  Hi, I'd like to implement the following but I have no idea where to start: I have a JTable with 1 column containing... the user to select a date which is then shown inside the cell and also modified
jquery date picker
jquery date picker  I am developing a business calendar.i used the Jquery datepicker plugin.I just now want to get the dates from the the calendar and should get the alert message soon after i click on the particular date.The
Set Date limit for dojo date picker dynamically - Date Calendar
Set Date limit for dojo date picker dynamically  Hi all, I am using Dojo's date picker in my project. I am trying to set min & max value for disable dates from date picker. There are two fields which are using this date
Time Picker in struts 2 - Struts
Time Picker in struts 2  How to create Time Picker in Struts 2 ? ...;head> <title>Struts 2 Time Picker Example!</title>... to get the solutions of your time picker problem in struts 2.RegardsVinod
javascript current date and time.
javascript current date and time.  How can we display current date and time using javascript?   <html> <head> <title>... with current day,date,time and GMT.You can have your own format
want a program for date picker by using java swings
want a program for date picker by using java swings  to write a program for the date picker by using java swings.any one please help me by providing the code to this java date picker by using the java swings.previously a program
Add Date Time together
Add Date Time together  I want to add datetime with time and result... this in javascript. and first datetime is from the text box and another time is from second text box and add both the text box means datetime with time
Date & TIme - Development process
Date & TIme  Hi, I asked to insert Date and Time to database with am... with time. Hi Friend, To insert the date,use the following code in your...() that will insert date with time into database. So to use this method, you have
Mysql Date and Time
Mysql Date and Time       Mysql Date and Time is used to return the current date and time... Mysql Date and Time. To grasp this example, we use  Current_Timestamp query
date and time in awt(java)
date and time in awt(java)  sir, do you have an example of date in awt java which can be view over a textfield.   Display time in JTextField import java.util.*; import javax.swing.*; import java.awt.event.*; public
Mysql Date no Time
Mysql Date no Time       Mysql Date no Time is used to find out the current date with no time... no Time' in Mysql . In this Example, the date(now( ) ) return you the current
how to get time picker value in javascript of struts2
how to get time picker value in javascript of struts2  I am not able to get value of time picker in java script . my code is jsp java script var totime=dojo.widget.byId("totime").getValue(); how to get value please help me
JavaScript calendar date picker
{ } /* the table (within the div) that holds the date picker calendar */ .dpTable { font... picker We are going to discus about JavaScript calendar date picker. We have used basic JavaScript date picker functionality. We use drop-down calendar
time conversion - Date Calendar
time conversion  hoe to add time in php like 01:30:00 and 00:45:20 and 02:50:40
Date and Time - Swing AWT
Date and Time  the following program is developed in swings ..... the main objective of this program is to 1> get a date from user 2> retrieve the current date from the system 3> hence find out the difference
Data Time Picker is not taking as requried field - Struts
Data Time Picker is not taking as requried field   when it going to action what is default value?  Hi Friend, Please visit the following link: http://www.roseindia.net/struts/struts2/date/struts-2-datetimepicker
PHP Date and Time
PHP Date and Time The PHP Date and Time function is massively used in setting date and time of the server, validating date and time and controlling the functions of the software. ADS_TO_REPLACE_1 The PHP date and Time
JSP Date & Time - JSP-Servlet
JSP Date & Time  Hi! How to compare a String with System time in JSP.... pls... help me... Thanks in advance
org.webjars.bowergithub.vaadin - vaadin-date-picker version 3.0.0-beta5 Maven dependency. How to use vaadin-date-picker version 3.0.0-beta5 in pom.xml?
; - Version 3.0.0-beta5 of vaadin-date-picker in pom.xml? How to use vaadin-date... 3.0.0-beta5 of vaadin-date-picker in project by the help of adding the dependency.... The developers of   org.webjars.bowergithub.vaadin - vaadin-date-picker
org.webjars.bowergithub.vaadin - vaadin-date-picker version 4.3.0-alpha1 Maven dependency. How to use vaadin-date-picker version 4.3.0-alpha1 in pom.xml?
; - Version 4.3.0-alpha1 of vaadin-date-picker in pom.xml? How to use vaadin-date... 4.3.0-alpha1 of vaadin-date-picker in project by the help of adding.... The developers of   org.webjars.bowergithub.vaadin - vaadin-date-picker
How to convert date to time in PHP?
How to convert date to time in PHP?  Hi, programmer. The PHP..., but as a readable date and time, it leaves much to be desired. Luckily, the PHP... google search and found some PHP Date time scripts listed on the page. Glad
date_time_set
date_time_set date_time_set alias DateTime::setTime function resets... the modified date and time.  Syntax public DateTime DateTime::setTime ( int $hour , int $minute [, int $second ] ) DateTime date_time_set ( DateTime $object
com.vaadin - vaadin-date-picker-flow version 24.0.10 Maven dependency. How to use vaadin-date-picker-flow version 24.0.10 in pom.xml?
com.vaadin  - Version 24.0.10 of vaadin-date-picker-flow Maven dependency? How to use  com.vaadin  - Version 24.0.10 of vaadin-date-picker-flow in pom.xml? How to use vaadin-date-picker-flow version 24.0.10 in pom.xml
com.vaadin - vaadin-date-picker-flow version 1.3.0 Maven dependency. How to use vaadin-date-picker-flow version 1.3.0 in pom.xml?
com.vaadin  - Version 1.3.0 of vaadin-date-picker-flow Maven dependency? How to use  com.vaadin  - Version 1.3.0 of vaadin-date-picker-flow in pom.xml? How to use vaadin-date-picker-flow version 1.3.0 in pom.xml? Learn
com.vaadin - vaadin-date-picker-flow version 24.1.1 Maven dependency. How to use vaadin-date-picker-flow version 24.1.1 in pom.xml?
com.vaadin  - Version 24.1.1 of vaadin-date-picker-flow Maven dependency? How to use  com.vaadin  - Version 24.1.1 of vaadin-date-picker-flow in pom.xml? How to use vaadin-date-picker-flow version 24.1.1 in pom.xml? Learn
PHP Date and Time
 The PHP Date and Time functions are very useful in manipulating the Date in your PHP program. The PHP Date and Time generates the current date and time in runtime dynamically. Following example prints the current date: You can
date format to be updated with current date time
date format to be updated with current date time  package LvFrm...; JButton b1,b2; //for date month year entry String strD[]={"Day","1...); /*for date entry & adding date into panel 2 also addind panel
PHP Date and Time Functions
The PHP Date and Time Functions functions allows the developer to read the current system time in easy and convenient way. It also helps the developers... of the examples of PHP Date and Time Functions.ADS_TO_REPLACE_1 Printing amount of seconds
Sql Date and Time Format
Sql Date and Time Format       The Tutorial illustrate an example from the 'Sql Date and Time...; is used to  format date and time.  SYNTAX:- DATE_FORMAT(date,format)ADS
Display Date and Time - Design concepts & design patterns
system date and time . Thanks Prakash  Hi Friend, Try the following code: System Date and Time var date = new Date(); document.write("System date and Time is: "+ date); Thanks
updated with current date n time
updated with current date n time  package LvFrm; import...; //for date month year entry String strD[]={"Day","1","2","3","4","5...); panel2.setBorder(b2); frm.add(panel2); /*for date entry

Ads