Date conversion- String to Datetime

Hi guys,

I'm trying to convert the string date to DateTime format following the way:
Insert date from power table to database.

Date = dsData.getValueAt(rowIndex,'Date')
date = system.date.parse(Date, "yyyy-MM-dd  hh:mm:ss.SSS")

Got error

Required this format (database format):
image

Ignition - 8.1.17
SQL Server 16

Any suggestion?

Thanks,
Priyanka

the format string in system.date.parse() requies it to match the format of the string coming in.

date = system.date.parse(Date, 'dd.MM.yyyy')
3 Likes

@JordanCClark Thank you so much.

Work perfectly!!