Hi,
I'm importing some data from a text file but I have a field that looks like this
30/12/1899 15:25:00
it is time field from an access DB that when exported shows the date and time (ie date = 0) now I want just the time to put into an SQL Server.
The only thing I can think to do is treat it as a string and cut it up to get '15:25:00' and then to put that into a char field in the DB.
There has to be a better way? can anyone help?
Thanks
Hello, if you are storing your date in a string format you can do this:// Long Time
string LongTime = DateTime.Now.ToString( "T" );
// => Displays 3:47:37 PM
regards
Thanks that works nicely.
I am glad I was able to help. But watch out, if you intend to do datecomparison, that is not a good solution, its then better to storeDateTime in a DateTime field.
regards
0 comments:
Post a Comment