jQuery UI Datepicker with hour and minute

Adding a Timepicker to jQuery UI Datepicker

The timepicker addon adds a timepicker to jQuery UI Datepicker, thus the datepicker (jQueryUI) is required for using any of these. In addition all datepicker options are still available through the timepicker addon.

Back to Blog

Download

Download Timepicker Addon

Download Timepicker Addon Minified

There is a small bit of required CSS:

/* css for timepicker */
#ui-timepicker-div dl{ text-align: left; }
#ui-timepicker-div dl dt{ height: 25px; }
#ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }

Donation

Has this Timepicker Addon been helpful to you?

Some Examples

Add a simple timepicker to jQuery UI's datepicker

$('#example1').datetimepicker();

Show time in AM/PM 12 hour format

$('#example2').datetimepicker({
	ampm: true
});

Show only the time picker without date picker

$('#example3').timepicker();

Change the format (default is "hh:mm tt")

h
Hour with no leading 0
hh
Hour with leading 0
m
Minute with no leading 0
mm
Minute with no leading 0
s
Second with no leading 0
ss
Second with no leading 0
t
a or p for AM/PM
tt
A or P for AM/PM
T
am or pm for AM/PM
TT
AM or PM for AM/PM
$('#example4').datetimepicker({
	timeFormat: 'h-m'
});

Show Seconds, Minutes, or Hours

showHour
Show the hour, default=true
showMinute
Show the minute, default=true
showSecond
Show the second, default=false
$('#example5').datetimepicker({
	showSecond: true,
	timeFormat: 'hh:mm:ss'
});

Hours, Minutes, Seconds in steps

stepHour
hour steps, default=1
stepMinute
minute steps, default=1
stepSecond
second steps, default=1
$('#example6').datetimepicker({
	showSecond: true,
	timeFormat: 'hh:mm:ss',
	stepHour: 2,
	stepMinute: 10,
	stepSecond: 10
});

Default Hours, Minutes, Seconds

hour
default=0
minute
default=0
second
default=0
$('#example7').datetimepicker({
	hour: 13,
	minute: 15
});

Version

Version 0.5

Last updated on 6/16/2010

jQuery Timepicker Addon is currently available for use in all personal or commercial projects under both MIT and GPL licenses. This means that you can choose the license that best suits your project, and use it accordingly.

GPL License

MIT License

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值