VB Date problem

liunx

Guest
Im using VB.NET and i need to do some date validations:

I need to check if the time component of a date is 0:00:00 if its not, then i need to set it to be that.

How do i do this?

ie.



if(NOT(myDate.Timepartofdate) = "0:00:00") then
meDate.Timepartofdate = "0:00:00"


Timepartofdate is obviously wrong...You can just attempt to compare a date with the same date but the time being midnight which is equal to just the date part.... 12/1/00C# version of some code I just whipped up (dt is a DateTime variable)

dt.add(dt.TimeOfDay.negate()).toString()



Should get the date back to a format of

1/1/2005 12:00:00 AM


0:00:00 - I'm not sure that you can set the time to that as I don't think it's a valid time value.Actually the are the sonomous with each other, beside he is using VB.net which allows you to do more things with date type checking than C#.thanks guys, ill give that a try and let you know...
 
Back
Top