
DateTime StartTime = ConvertToDateTime(DateTimeNowToShortDateString());
string StrSelect = RequestForm["dtSelect"]ToString();
SearchInfoStartTime =StrSelect;
if (SearchInfoStartTime != "")
{
if (!(DateTimeTryParse(SearchInfoStartTime, out StartTime))) //同理其他类型也可如法炮制的进行判断
{
SearchInfoStartTime = "2012-1-4";
}
}
Date currDate = CalendargetInstance()getTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateTime = sdfformat(currDate);
dateTime即你需要获取的时间,格式为:yyyy-MM-dd HH:mm:ss。
望采纳。。。
以上就是关于如何判断传过来的参数是否是时间类型全部的内容,包括:如何判断传过来的参数是否是时间类型、Servlet获取时间,详见补充,有加分哦!、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)