sfa-siard / SiardGui

SIARD Suite - SiardGui
Other
17 stars 3 forks source link

How SIARD handle datetime in specific format #45

Closed PeterChan1 closed 1 year ago

PeterChan1 commented 2 years ago

Hello, May I know if it is feasible to instruct how SIARD handle datetime in specific format?

For example, it has a Microsoft Access database storing the date and time in form of DD/MM/YYYY HH:MM:SS

image

The date and time format become MM/DD/YY HH:MM AM/PM under SIARD: image

Please share if SIARD would handle datetime in specific format. If so, is the format configurable? I checked, but it seems not following the date time settings configured on the computer where SIARD run. Thank You.

walkerjan commented 2 years ago

Hello @PeterChan1

You have to distinguish: (1) the format in which the data of a SIARD archive is presented to the user in the GUI from (2) the format in which the data is stored in the XML files of a SIARD archive.

(1) The format in which datetimes are presented to the users in the table preview of the GUI is MM/DD/YY HH:MM (as you mentioned) and cannot be configured in the options menu of the GUI.

(2) The format (regex pattern \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d+)?Z?) in which datetimes are stored inside a SIARD archive is specified in the respective table.xsd file, as you can investigate by browsing through an example archive.

I hope this answers your question.

PeterChan1 commented 2 years ago

Hello @walkerjan

Thanks for the information. I located the table.xsd file after unzipping the .siard file. And then I customized the date time format in table.xsd, modified the raw data to in line with date time format specified. I zipped and packed it as .siard file in an attempt to upload the content into target database. However, it returned with error that the .siard file is invalid.

image

Would you mind sharing how to edit the table.xsd file that lead to successful import?

Thank You.

walkerjan commented 2 years ago

Hello @PeterChan1

Can you please share your example SIARD archive so that we can try to spot the error in your specification. Thanks.

PeterChan1 commented 2 years ago

Hello @walkerjan

Enclosed please find the original and modified siard files.

siard files.zip

As a trial, I tried to change the date time format from original YYYY-MM-DD hh:mm:ss format to DD-MM-YYYY one.

Enclosed please find the changes made to the new SIARD file for reference. Thank You.

content\schema0\table0\table0.xml:

15-07-2019Z 18-06-2022Z 27-12-2021Z

content\schema0\table0\table0.xsd:

header\table.xsd:
StephGit commented 1 year ago

Hello @PeterChan1

(1) As @walkerjan mentioned the format in the table preview of the GUI cannot be configured - but should represent the settings of your system. To customize this setting via the options would be an enhancement.

For example a screenshot of your original file on my system: 2022-11-29_11-07

(2) The format in which datetimes ect. are stored inside a SIARD archive is specified through the Schema. Your schema definition is not valid.

mburri commented 1 year ago

System settings determine the format in which data is displayed. This cannot be configured in the application.

It is not recommended to make manual adjustments within the SIARD archive to change the date format, as this may result in invalid archive files.

As this is not a bug in the application, we close this issue.