Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
VB
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
Posted
Updated 12-May-21 8:51am
v2
Comments
lekha g nair 24-Feb-15 1:02am    
Substring(0, 10) = "00-00-0000"

1 solution

Try specifying the format string:
VB
.ToString("yyyy-MM-dd") 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900