开发者

getting both time and date from calendar control

开发者 https://www.devze.com 2023-02-08 02:15 出处:网络
hi i am using calender control in asp.net. in this i want to get bothcurrent time andcurrent date.how开发者_开发知识库 can i do this? i am using the language c#. help meYes we can with an amendment..

hi i am using calender control in asp.net. in this i want to get both current time and current date. how开发者_开发知识库 can i do this? i am using the language c#. help me


Yes we can with an amendment.. Example

DateTime dt = Convert.ToDateTime(Calendar1.SelectedDate.ToShortDateString());
TimeSpan ts = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
dt=dt.Add(ts);
txtreffDt.Text = dt.ToString();


You can't. The ASP.Net Calendar is just that - a calendar. Calendars only deal with dates. You'll need a third party DateTimePicker control or similar.

0

精彩评论

暂无评论...
验证码 换一张
取 消