What should I use to get only time in gridview
I want to fetch only 03:42
but getting 01-01-1900 03:42:00
how to do this
This is code
cmd.CommandText = "select bumker1 Bumker_1, bumker2 Bumker_2, bumker3 Bumker_3, silo Silo_No, start_time Drier_Strt_Time, end_time End_Time, hexa_resol Hexa_Sol_Prep, hexa_used Hexa_Used, batch_coated Coated_Batch, resin_used Resin_Used, sand_quantity Make from mm_sandPreparation s where date='" & Format(CDate(sanddate.Text), "MM/dd/yyyy") & "' and shift='" & rblshift.SelectedValue & "' " Using sda As New SqlDataAdapter() sda.SelectCommand = cmd Using dt As New DataSet() sda.Fill(dt) vw_sand_details.DataSource = dt vw_sand_details.DataBind() End Using End Using
Advertisement
Answer
SELECT CONVERT(VARCHAR(5), GETUTCDATE(), 108)
will return the output in HH:MM
format as 07:26
So in your query
SELECT CONVERT(VARCHAR(5), start_time, 108)
will return the datetime into HH:MM
format