Bootstrap-datepicker is a very good time to select Plug-ins, the default is the English display date. This article introduces Bootstrap DatePicker with Chinese JS files.
Jsif ($ (". DatePicker") with previous references to bootstrap. Length > 0) {
$ (". DatePicker"). DatePi
DataPicker is similar to the TimePicker mentioned in the previous section. DatePicker allows you to select a specific date. The following describes how to use DatePicker.
1. Use the project in the previous section, BasicViews4, and modify main. xml.
[Html]Android: layout_width = "fill_parent"Android: layout_height = "fill_parent"Android: orientation = "vertical">Android: layout_width = "wrap_content"Android
A calendar Layout View with year, month, and day selected
Java. Lang. Object
Android. View. View
Android. View. viewgroup
Android. widget. framelayout
Android. widget. datepicker
Public int getdayofmonth ()
Obtain the number of days selected
Public int getmonth ()
Obtain the selected month. (Note: The returned value is 0 .. 11, which must be displayed with + 1)
Public int getyear ()
Obtain the selected
Android.widget.datepicker;import Android.widget.TextView; Import Android.widget.timepicker;public class Datetest extends activity {/** Called when the activity is first created . */TextView TextView; Timepicker Timepicker; DatePicker DatePicker; Button btn1; Button btn2; Calendar class in Java calendar C; @Override pu
= "wrap_content"Android: layout_height = "wrap_content"Android: text = "getting the set time"Android: layout_below = "@ id/timePickerId"Android: layout_centerHorizontal = "true"Android: layout_marginTop = "50dp"/>
2. DatePicker1. DatePicker does not have a listener interface similar to OnTimeChangedListener like TimePicker. There is a dialog box that will be added later.For more information, see setting the DateP
Introduction
The following uses an example to show the functions and usage of datepicker and timepicker.
Step 1: Create a project dateandtimepicker
Step 2: Compile the app UI/layout/Main. xml
Step 3: main program mainactivity. Java
Package CN. roco. picker; import Java. util. calendar; import android. app. activity; import android. OS. bundle; import and
This article describes the use of DatePicker and Timepicker in Android in an example, as follows: The following is the code that implements the specific functionality, where main.xml code is:
Java code is:
public class Androiddemo5activity extends activity {//log current time private int year;
private int month;
private int day;
private int hour;
private int minute; @Override pr
Learning Essentials:
Call the DatePicker () method
Modify the DatePicker () style
Properties of the DatePicker () method
Events for the DatePicker () method
First, call the DatePicker () method$ (' #date '). Dat
This example describes the jquery date selection DatePicker plug-in usage. Share to everyone for your reference. Specifically as follows:
1, first of jquery in the DatePicker plug-ins in the relevant attribute values to Chinese:
$.datepicker.regional[' ZH-CN '] = {cleartext: ' Clear ', Clearstatus: ' Purge selected date ', Closetext: ' Close ', Closestatus: ' Do not change Current selection ', Prevtex
First of all, I thank NetEase lofter bo Master Ivy Blog, I just realized the problem, I hope to the back with these several plug-in children's shoes a reminder, do not make the same mistakes with me.
This is the blog written by Lvy blogger: http://10305101ivy.blog.163.com/blog/static/5847658920135434648580/
API call on the Internet a lot, I do not introduce, we own Baidu. But be sure to pay attention to their different uses.
The main point here is the difference:
First, the
the JQuery UI implements the start date (mindate) and end Date (maxdate) using the DatePicker plug-in
Using the jquery UI you first need to introduce the JQuery class library, the jquery UI JS script, and the jquery UI CSS style sheet. The code example is as follows:
Note: When you introduce a JS script, you need to introduce the JQuery class library, and then introduce the jquery UI script
Here are two implementation steps:
thought one:
The fi
/datepicker/. Here, only some of the commonly used properties are described.1, datepicher the simplest useJavaScript code$ ("#regDate"). Datepicher (); Where regdate is the id attribute value of the page date input box.In this sentence, when the date input box gets the focus, a date selection window pops up. However, this time the Date Selection window has a lot of inconvenient places, such as: Only one months and one months forward or backward, the
DatePicker
Chinese style after localization problem
DatePicker
After Chinese culture, set
Changemonth, Changeyear to True
, the style will have an incompatibility problem.
Solution:
Among the official jquery-ui-1.7.2.custom.css, the areas to be modified are:
. ui-datepicker. ui-datepicker
implementing an interface requires a class, so there is no class. Java programming only starts in the No. 0 month. Only 11 months.2, the replication oncreatedialog (int id) method: (When creating a dialog, must be created by Oncreatedialog) // @Override protected Dialog Oncreatedialog (int ID) { switch (ID) { case date_picker_id: return new Datepickerdialog (this , ondatesetlistener , 2010,11,25); Generate a new Datepickerdialog object
Let's take a look:
Post the followingCodeHere, the main. XML code is:
The Java code is:
Public class androiddemo5activity extends activity {// record the current time private int year; private int month; private int day; private int hour; private int minute; @ overrideprotected void oncreate (bundle savedinstancestate) {// todo auto-generated method stubsuper. oncreate (savedinstancestate); setcontentview (R. layout. main);
Let's look at the property sheet for the DatePicker plug-in:
Use instance of the first calendar plug-inFirst import the required class library files:
Write the page code first:
Then use the JS code to invoke the plug-in
Screenshot of Effect:
The following examples verify some common properties:1. Altfield: Use the alternate output field, the date to be selected in another format, output to another control, th
jquery is a very good scripting framework, and its rich controls are simple to use and very flexible to configure. Here is an example of using the date plugin Datapicker.
1, download the jquery core file, needless to say, DatePicker is a lightweight plug-in, just the min version of jquery on the line, and then to the official website http://jqueryui.com/ Download Download Jquery-ui Compression package (you can choose to like the theme), which contains
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.