我想知道是否可以在DateTimePicker中禁用所选日期,以便用户无法选择它们.我知道它可能在网络表单,但在Windows窗体我无法做到这一点.我可以实现这一点.
我在Winforms OnLoad事件中有以下代码:
dtpStartDateFilter.Value = DateTime.MinValue;
Run Code Online (Sandbox Code Playgroud)
dtpStartDateFilter是一个标准的WinForms日期时间选择器.当我的表单加载它遇到先前输入的代码行然后退出(使用WinForms吃异常所以我不知道它是什么).
这样做有什么问题?
我正在使用带有时间插件的jQuery UI datepicker.这就是我在datepicker本身的页面上显示时间的方法:
21.06.2012 08:00
Run Code Online (Sandbox Code Playgroud)
我想在发送到后端之前将此时间转换为UNIX时间戳.我怎样才能做到这一点?我不需要在页面上显示UNIX时间,我只需要在发布之前进行转换.我试过了:
var d = Date.parse(value_of_datepicker);
Run Code Online (Sandbox Code Playgroud)
但没有运气.似乎日期应该以另一种方式形成.此外,我已经尝试了几个内置的datepicker函数,但所有这些函数都设置了日期显示视图.谢谢.
javascript jquery-ui datepicker datetimepicker unix-timestamp
我的jquery代码:
$('#DatePicker').datetimepicker({
timepicker : false,
format : 'd.m.Y',
minDate : 0
});
Run Code Online (Sandbox Code Playgroud)
在这个jquery我使用datetimepicker plugin.i想要设置最小日期是明天date.in此代码我设置最小日期是today.how设置最小日期是明天日期.
我正在使用bootstrap日期选择器,但不幸的是它不支持jalali日历.我在谷歌搜索转换它,但我没有找到任何有用的东西.所以我需要更改datepicker并自定义它,如下图所示.

你可以在http://codepen.io/anon/pen/BjqxOq找到完整的代码
我正在使用Materialize CSS显示一个登录表单,您可以在上面的Codepen中看到.它有两个按钮登录和注册.单击"注册"时,将显示一个包含必要注册字段的模式,其中一个是物化日期时间选择器.
是否有可能更改datetimepicker的默认正文颜色?
HTML
<div class="row">
<div class="input-field col s6">Date of Birth
<input type="date" class="datepicker ">
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
JS
$(document).ready(function(){
$('.datepicker').pickadate({
selectMonths: true, // Creates a dropdown to control month
selectYears: 15 // Creates a dropdown of 15 years to control year
});
});
Run Code Online (Sandbox Code Playgroud) 我们在表单上的自定义UserControl上有几个DateTimePickers.它们是可见的,但未启用(仅用于显示目的).加载UserControl时,DateTimePickers将从DataRow中分配值,该DataRow来自DataSet,后者存储从SQL Server存储过程返回的单个记录.
存在一种不一致的行为,其中用户有时会看到今天的日期而不是分配给DateTimePicker的日期.我是否将我想要的日期分配给.Value属性或.Text属性似乎无关紧要:
txtstart.Value = (DateTime) dr["Group_Start_Date"];
txtend.Text = dr["Term_Date"].ToString();
Run Code Online (Sandbox Code Playgroud)
我期望在上面的两个语句中,使用Value属性的语句更合适.但是,在这两种情况下,无论数据库中的值如何,都会向用户显示今天的日期.对于txtstart.Value,Visual Studio向我显示该值已按预期分配.那么为什么不向用户显示该日期而不是今天的日期呢?
我正在使用materialdatetime选择器来创建表单.如果我正在使用TextView,它运行良好,但我想使用EditText,我上传你可以看到的图像,如果我使用EditText它看起来如何,如果我使用TextView它看起来如何.但是当使用EditText时我需要单击两次才能打开DatePicker.首次点击它的行为就像一个可编辑的文本框.
<!-- Adding Payment Method progress -->
<ProgressBar
android:id="@+id/payment_method_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/adding_payment_method_heading"
android:textSize="@dimen/activity_heading"
android:elevation="0dp"
android:layout_marginBottom="@dimen/activity_vertical_margin"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/adding_payment_method_description"
android:textSize="@dimen/activity_description"
android:elevation="0dp"
android:layout_marginBottom="@dimen/activity_vertical_margin"
/>
<ScrollView
android:id="@+id/adding_payment_method_view"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/adding_payment_method_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout_user_id"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/enter_user_name"
android:inputType="text"
android:maxLines="1"
android:singleLine="true"
android:id="@+id/user_id" />
</android.support.design.widget.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:text="Select Payment Methods" />
<Spinner
android:id="@+id/payment_methods"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" …Run Code Online (Sandbox Code Playgroud) 我有一个datetimepicker,我在数据集中绑定了可空的日期/时间列.我成功地将Format事件应用于null而不是null对象值.但是,当我取消选中dtp控件时,它不会在数据集中设置为null.这是我的代码:
dtpBirthdate.DataBindings.Add(new Binding("Value", bsStaff, "birthDate", true));
dtpBirthdate.DataBindings["Value"].Format += new ConvertEventHandler(dtpFormat);
dtpBirthdate.DataBindings["Value"].Parse += new ConvertEventHandler(dtpParse);
Run Code Online (Sandbox Code Playgroud)
格式和解析事件:
private void dtpFormat(object sender, ConvertEventArgs e)
{
Binding b = sender as Binding;
if(b != null)
{
DateTimePicker dtp = (b.Control as DateTimePicker);
if(dtp != null)
{
if (e.Value == null || e.Value == DBNull.Value)
{
dtp.Checked = false;
dtp.CustomFormat = " ";
e.Value = false;
}
else
{
dtp.Checked = true;
dtp.CustomFormat = "dd-MMM-yyyy";
dtp.Value = (DateTime) e.Value;
}
}
}
}
private void …Run Code Online (Sandbox Code Playgroud) 我尝试这样做,禁用所有日期并启用我通过参数传递的日期
这段代码不起作用
$.ajax({
method: "GET",
url: "url",
})
.success(function(msg) {
console.log(JSON.parse(msg));
var disableIni = JSON.parse(msg);
var disable = [];
for (var i = 0; i < disableIni.length; i++)
{
disable[i] = moment(disableIni[i][0] + "/" + disableIni[i][1] + "/" + disableIni[i][2], "M/DD/YYYY");
if (i > 5)
{
break;
}
}
console.log(disable);
var vectorTest = [moment("5/25/2017", "M/DD/YYYY"), moment("5/26/2017", "M/DD/YYYY"), moment("5/27/2017", "M/DD/YYYY")];
console.log(vectorTest);
var vector = disable;
console.log(vector);
$('#input_from').datetimepicker({
locale: 'es',
format: 'DD-MM-YYYY',
enabledDates: $.each(vector, function(i, value) {
return value;
})
});
}); …Run Code Online (Sandbox Code Playgroud) jquery datetimepicker bootstrap-datetimepicker eonasdan-datetimepicker
datetimepicker ×10
c# ×4
winforms ×3
.net ×2
datepicker ×2
jquery ×2
android ×1
binding ×1
css ×1
html ×1
html5 ×1
javascript ×1
jquery-ui ×1
materialize ×1
nullable ×1
parsing ×1
xml ×1