N newbie Member Licensed User Longtime User Apr 7, 2017 #1 Hello, need help to convert a sql.Timefield to Hours,minutes, second I have try to read the field as long and then convert it with DateTime.GetHour but this don't work. Found nothing in the forum. Thanks for Help
Hello, need help to convert a sql.Timefield to Hours,minutes, second I have try to read the field as long and then convert it with DateTime.GetHour but this don't work. Found nothing in the forum. Thanks for Help
udg Expert Licensed User Longtime User Apr 7, 2017 #2 If you're referring to a MySql Time column, please have a look here for its specifics. Anyway, if you save time of day as hh:mm:ss in that column then you first have to read it back as a string and finally convert it by DateTime.TimeParse function which gives you the right number of ticks (date part is set to today). Only then you use functions to extract separately hours, minutes and seconds. Beware of TimeFormat set in your app before parsing to avoid errors (it should be "HH:mm:ss" if that is what you read back from SQL). udg Upvote 0
If you're referring to a MySql Time column, please have a look here for its specifics. Anyway, if you save time of day as hh:mm:ss in that column then you first have to read it back as a string and finally convert it by DateTime.TimeParse function which gives you the right number of ticks (date part is set to today). Only then you use functions to extract separately hours, minutes and seconds. Beware of TimeFormat set in your app before parsing to avoid errors (it should be "HH:mm:ss" if that is what you read back from SQL). udg