Я отображаю дату и время в столбце DataViewGrid, и это работает так же, как и ожидалось, если это не полуночи, а затем она отображает только дату. Я хочу, чтобы это отображало время, независимо от того, что.
< /p>
< /p>
< /p>
// Stores the SQL query to populate the appointments DataGridView.
string str_sql = "select title as Title, start as Start, end as End, " +
"customer.customerName as Customer, " +
"user.userName as Consultant, appointmentId as ID " +
"from appointment as appt " +
"left join customer on customer.customerId = appt.customerId " +
"left join user on user.userId = appt.userId " +
"order by start;";
// Associates the SQL command with the active MySQL connection.
MySqlCommand cmd = new MySqlCommand(str_sql, mysql.Conn);
// Creates a data table to store the results of the SQL query.
DataTable dt_appointments = new("Appointments");
// Fills the data tablewiththe output from the query.
dt_appointments.Load(cmd.ExecuteReader());
// Loops through each row in the appointments data table.
foreach (DataRow dr in dt_appointments.Rows)
{
// Adjusts the appointment start and end times from UTC to the user's local time.
dr["Start"] = dr["Start"].As().ToLocalTime();
dr["End"] = dr["End"].As().ToLocalTime();
}
// Tells the DataGridView that its data source is the data table (sql query results).
dgv_appointments.DataSource = dt_appointments;< /code>
< /div>
< /div>
< /p>
Спасибо за вашу помощь,
Christian < /p>
Подробнее здесь: https://stackoverflow.com/questions/797 ... midnight-t
.Net DataViewGrid отображает как дату, так и время в столбце, если не на полуночи, тогда вы видите только дату ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Найдите текущую дату в столбце «A» и обновите текущее время в столбце «B» (в Excel 2010).
Anonymous » » в форуме Python - 0 Ответы
- 15 Просмотры
-
Последнее сообщение Anonymous
-