Hi
I use system.dataset.toExcel() to export the chart dataset and save it as excel.
After upgrading to 8.1.1 the system.dataset.toExcel() doesn’t show time in the ‘t_stamp’ column by default and only show date. User have to change the cell format to see time.
Is there any way to force to show both date and time for t_stamp column like 8.0.x?
toExcel
is supposed to create the Excel file so that the date is rendered in whatever your Excel instance deems the ‘default’ date format. If you want a particular format, you could do a (lossy) string conversion before export using system.dataset.formatDates
.
This is what I was believe before but why in the same computer with two ignition installation, one with 8.0.12 and on 8.1.1 with same project I get two different result in just date and time format?
This proves there is a regression in 8.1.1.
There’s no change in the date format toExcel
uses between 8.0.12 and 8.1.1; the change to use the default date format was introduced in 8.0.10. Do you have a script that you’re using or an Excel file you can upload that demonstrates the problem?
Sure. As it shown in image, I simply get the chart dataset data and convert that dataset to excel.
dataset = self.parent.parent.getChild("FlexContainer").getChild("Chart Area").getChild("TimeSeriesChart").props.series[0].data
file = self.view.params.tagPath
file = file.replace("[default]","")
file = file.replace("/"," ")
system.perspective.download(file + '.xlsx', system.dataset.toExcel(True,[dataset],True))
Sites Alex.xlsx (3.8 KB)
Can you upload an 8.0.10 exported sheet as well? I did an export on 8.0.10 vs 8.1.2 and I can’t reproduce - both dates look the same on initial import.
Sure.
INLET PI126 PV.xlsx (37.5 KB)
Did you get time hour as well in your test?
So, the second file you uploaded displays that way because they’re not actual dates - in the file itself, the date-times are represented as strings - so exactly the same as what you’d get from system.dataset.formatDates
. I’d also argue that while the behavior changed, the new behavior is strictly better - now dates are represented as ‘true’ date objects from Excel’s perspective, instead of strings.
EDIT: As compared to ‘Sites Alex’; notice the 44216 ‘serial number’ date (How Dates Work in Excel - The Calendar System Explained + Video - Excel Campus)