Groups | Blog | Home
all groups > dotnet general > may 2004 >

dotnet general : Formatting a number into a time



suresh
5/25/2004 9:20:45 PM
Hi,

I have a textbox that a user inputs a time that I then insert into SQL
server. In the code behind I add a date to the existing content. When I try
to insert into the database (field is smalldatetime) I receive and error.
The error occurs because the value does contain a colon.
How would I convert ex. 1/1/1900 300 AM into 1/1/1900 3:00 AM


Thanks,

Suresh

Cor Ligthert
5/26/2004 11:47:52 AM
Hi Suresh,

When it is a string and VB net I mostly only have to do
datetime = CDate("1/1/1900 300 AM")

Maybe this works for you?

Cor

AddThis Social Bookmark Button