如何将00-00-0000 12:00:00 AM格式转换为00-00-0000格式 [英] HOW to convert 00-00-0000 12:00:00 AM format to 00-00-0000 format

查看:167
本文介绍了如何将00-00-0000 12:00:00 AM格式转换为00-00-0000格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在日期为00-00-0000 12:00:00 AM格式时在视图页面中查看我的日期为空。

我的代码是

I want to view my date as null in view page when the date is in 00-00-0000 12:00:00 AM this format.
My code is

If objODBCDataReader.Item("dc_date").ToString.Substring(0, 10) = "0000-00-00" Then
                  txtdcdate.Text = ""
              Else
                  txtdcdate.Text = objODBCDataReader.Item("dc_date")
              End If



不工作


its not working

推荐答案

尝试指定格式字符串:

Try specifying the format string:
.ToString("yyyy-MM-dd") 

并查看是否有帮助。

如果不这样做,ToString操作将使用当前默认的日期转换设置为计算机运行,可能是任何东西,但很可能是dd / MM / yyyy或MM / dd / yyyy

and see if that helps.
If you don't, the ToString operation uses the current default date conversion set for the computer it is run on, which could be anything, but most likely is dd/MM/yyyy or MM/dd/yyyy


这篇关于如何将00-00-0000 12:00:00 AM格式转换为00-00-0000格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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