Getting time from datetimepicker to mysql time data type

I have a datetimepicker with the usual 24-hour format HH: mm: ss select only hours

then i declared mydtIncidentTime as DateAndtime

    mydtIncidentTime = dttimepicker.Value.ToString("HH:mm:ss")

Im saving time only in 24 hour format for my saving time to mysql (mysql data type is TIME)

    str_to_date('" & Me.mydtIncidentTime & "', '%H:%i%s')
+4
source share
1 answer

you can use the MySQL TIME_FORMAT () function.

SELECT TIME_FORMAT(timeout_pm, '%h:%i:%s %p') time_12h
  FROM dtr
 WHERE ...

You can find the SQLFiddle demo

+2
source

Source: https://habr.com/ru/post/1529129/


All Articles