#1 2018-03-01 17:17:04

triguinhu
Member
From: Brazil
Registered: 2016-07-28
Posts: 27

DateTime Format - SQLite Date Format (US) to Brazilian Date Format

Hi


for display in the client application, what is the best way to convert the date that returns via RetrievelistJSON from a SQLite database to the format dd/mm/yyyy?
Date format displayed is yyyy-mm-dd

This data is displayed in a DBGrid, and the problem is just the display!
To manipulate the data in ISO format that Mormot uses, everything is perfect!

The view I believe should be done in the client application, am I correct?

I already tried masks in DBGrid.DataSource.DataSet, I tried to bring the DocVariantData data with the set dbFieldsTypes but it did not work at all!
I did not want to have to bring the data to a TSQLTable or another TDataSet to process! This would bring an extra layer of data processing!

How to proceed?

Thanks

Rodrigo

Offline

#2 2018-03-05 17:09:30

triguinhu
Member
From: Brazil
Registered: 2016-07-28
Posts: 27

Re: DateTime Format - SQLite Date Format (US) to Brazilian Date Format

Hi all

I solve using this code:

    for i := 0 to high(vValues.Values) do
       vValues.Values[i].MyDateTimeField  := DateToStr(Iso8601ToDateTime(vValues.Values[i].MyDateTimeField));

Last edited by triguinhu (2018-03-05 18:06:22)

Offline

#3 2018-03-08 12:10:55

triguinhu
Member
From: Brazil
Registered: 2016-07-28
Posts: 27

Re: DateTime Format - SQLite Date Format (US) to Brazilian Date Format

Hi all,

DateToStr conversion in this case... Is wrong?

Is the correct way  UTF8 conversion to MyDateTimeField ? vValues.Values is TVariantDynArray...

Offline

Board footer

Powered by FluxBB