如何在asp.net中的单独dropdownlist中获取日期字符串 [英] how to get date string in seprate dropdownlist in asp.net

查看:63
本文介绍了如何在asp.net中的单独dropdownlist中获取日期字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有00/00/0000


我要
dropdown month = 0;
dropdown day = 0;
dropdown year = 0000;

日期已在sqldatabase中存储..

I have 00/00/0000


i want
dropdown month=0;
dropdown day =0;
dropdown year=0000;

the date is already strored in sqldatabase..

推荐答案


从数据库中获取日期并将其存储在字符串中;

Hi,
Fetch the date from database and store it in string;

string dtime= dbDateTime.toString("dd-MM-yyyy");
//Here dbDateTime will come from database as you are saying


现在将其拆分并保存在数组中:


Now split it and save it in an array:

string[] dateTimeSpl=dtime.Split('-');


现在,您可以根据需要使用格式设置日期时间.现在在数组中.

这是简单的例子.根据您的要求,您只需探索其用法即可.
祝一切顺利.
--AK


Now you got your datetime in your format as you want. It''s now in array.

This was the simple example. According to your requirement you just explore the usage..
All the best.
--AK


您可以在以下链接中找到参考:

http://www.dotnetspark.com/kb/5007-split-date-field-and-fill-comboboxes-c-sharpnet.aspx [ http://www.aspnettutorials.com/tutorials/controls/dropdownlist-binddate-csharp.aspx [^ ]
You can find the reference in the following link:

http://www.dotnetspark.com/kb/5007-split-date-field-and-fill-comboboxes-c-sharpnet.aspx[^]
http://www.aspnettutorials.com/tutorials/controls/dropdownlist-binddate-csharp.aspx[^]


这篇关于如何在asp.net中的单独dropdownlist中获取日期字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆