Click here to Skip to main content
Licence CPOL
First Posted 7 May 2011
Views 13,292
Bookmarked 1 time

jQuery UI Datepicker

By itpankaj | 7 May 2011 | Unedited contribution
Create Date picker using the JQuery. Use different theme and color for date window.
Closed because This item is a copy of an existing article and does not provide adequate reference to the original. Reported by Mark Nischalke, Indivara, Richard MacCutchan on Sunday, May 8, 2011 1:50 AM.

Download WebSite1.zip - 127.39 KB

Introduction

The jQuery UI Datepicker is a highly configurable plugin that adds datepicker functionality to your pages. You can customize the date format and language, restrict the selectable date ranges and add in buttons and other navigation options easily.

datepicker.png

Background

By default, the datepicker calendar opens in a small overlay onFocus and closes automatically onBlur or when a date is selected. For an inline calendar, simply attach the datepicker to a div or span.

You can use keyboard shortcuts to drive the datepicker:

•page up/down - previous/next month
•ctrl+page up/down - previous/next year
•ctrl+home - current month or open when closed
•ctrl+left/right - previous/next day
•ctrl+up/down - previous/next week
•enter - accept the selected date
•ctrl+end - close and erase the date
•escape - close the datepicker without selection

.

Using the code

Utility functions
•$.datepicker.setDefaults( settings ) - Set settings for all datepicker instances.
•$.datepicker.formatDate( format, date, settings ) - Format a date into a string value with a specified format.
•$.datepicker.parseDate( format, value, settings ) - Extract a date from a string value with a specified format.
•$.datepicker.iso8601Week( date ) - Determine the week of the year for a given date: 1 to 53.
•$.datepicker.noWeekends - Set as beforeShowDay function to prevent selection of weekends

 <!-- Add in head -->
<link type="text/css" rel="stylesheet" href="css/jquery-ui-1.8.12.custom.css"/>

<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>

<script type="text/javascript" src="js/jquery-ui-1.8.12.custom.min.js"></script>

<script type="text/javascript" language="javascript">

$(function() {

$("#datepicker").datepicker();

});

</script>

 

<!-- Add in Body -->

<p>Date: <input type="text" id="datepicker"></p>

 
        

Points of Interest

This is very easy to use. Only single line of code is required to implement the date picker.

History

Check for more details - http://jqueryui.com/demos/datepicker/#default

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

itpankaj

Software Developer (Senior)
Bank of America
India India

Member

Follow on Twitter Follow on Twitter
I have 6 years of experience in System Study, development, implementation and Support. Having excellent programming skills and have been involved in various business application development and support projects.
 
I am working as a software engineer in Bank of America Hyderabad. I am expertise in core part of SharePoint(2007-10) with C# 2.0,3.5,4.0, WCF, SQL Server and passionate about new Microsoft technologies.
 
Contact Details -
Email ID: itpankaj@gmail.com

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralPlagerized? PinsupporterMark Nischalke14:41 7 May '11  
GeneralNot an article... PinmvpDave Kreskowiak5:09 7 May '11  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120209.1 | Last Updated 7 May 2011
Article Copyright 2011 by itpankaj
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid