A
A
Andrey2018-03-30 14:26:27
C++ / C#
Andrey, 2018-03-30 14:26:27

WPF DataGrid how to output UnixTime?

Good day to all!
Please tell me if there is a better solution for such a task: It is necessary to display the temperature and date values ​​from the mysql database when the measurement was made. The date is stored in UnixTime.
If you generate columns automatically, then the column has a name If you write by handFROM_UNIXTIME(date_izm, '%d--%H:%i:%s')

<DataGridTextColumn Header="Дата" Width="200" Binding="{Binding Path='FROM_UNIXTIME(date_izm, '%d--%H:%i:%s')'}"></DataGridTextColumn>
then the studio swears. And in both cases, sorting does not work :(
Without converting to DataTime, everything works fine.
How is it generally more correct to do the conversion in this case?
(Please don’t kick me, I’m learning a new craft.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2018-03-30
@andrey71

So use converters when binding.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question