When designing ActiveReportsJS reports, the time type is often set. For example, short time, long time, short date, long date, etc. The time type in JSON is stored in the form of a string. When you use the Format function to set the time in report design, you need to convert the string to the time type and then set the time Format.

I’m gonna cut to the chase and show you

1, the first time conversion, the existing Json string type of data into time type \

Use datetime.parse () to convert the time type

Datetime.parse (< format String> [, <String>])

2. Open report Designer and bind data set of data source

[{“OrderID”: 10248, “CustomerId”: “VINET”, “CompanyName”: “Suntech “, “OrderDate”: “Other things, 11/01/31 10:00:00”, “Freight”: 32.38, “ProductID”: 42, “UnitPrice”: 9.8, “Quantity”: 10, “Discount”: 0, “Amount”: 98, “DiscountAmt”: 0, “NetAmount”: 98 }, { “OrderID”: 10248, “CustomerId”: “VINET”, “CompanyName”: “OrderDate”: “other, 10/31 07:00:00”, “Freight”: 32.38, “ProductID”: 72, “ProductName”: “Yogurt “, “UnitPrice”: 34.8, “Quantity”: 5, “Discount”: 0, “Amount”: 174, “DiscountAmt”: 0, “NetAmount”: 174}, {“OrderID”: 10248, “CustomerId”: “VINET”, “OrderDate”: “relevant “, “Freight”: 32.38, “ProductID”: 17, “ProductName”: “pork “, “UnitPrice”: 14, “Quantity”: 12, “Discount”: 0, “Amount”: 168, “DiscountAmt”: 0, “NetAmount”: 168 }, { “OrderID”: 10249, “CustomerId”: “TOMSP”, “CompanyName”: “OrderDate”: “other, 11/07/05 00:00:00”, “Freight”: 11.61, “ProductID”: 14, “ProductName”: “UnitPrice”: 18.6, “Quantity”: 9, “Discount”: 0, “Amount”: 167.4, “DiscountAmt”: 0, “NetAmount”: 167.4}]

3. After binding the data set of the data source, bind corresponding fields to the table

4. Convert the time type

{DateTime.Parse(OrderDate, "YYYY/MM/DD HH:mm:ss")}

5. Set the Format

6. Preview results