function OnInit(initData) { initData.name = 'Date taken UTC'; initData.version = '2021-07-17'; initData.url = 'https://resource.dopus.com/t/utc-vs-local-time-zone/39824'; initData.desc = ''; initData.default_enable = true; initData.min_version = '12.0'; } function OnAddColumns(addColData) { var col = addColData.AddColumn(); col.multicol = true; col.method = 'OnColumn'; col.name = 'Date taken (UTC)'; col.label = 'Date taken (UTC)'; col.header = 'Date taken (UTC)'; col.justify = 'right'; col.defwidth = 6; col.autorefresh = 1; col.autogroup = true; col.type = 'datetime'; var col = addColData.AddColumn(); col.multicol = true; col.method = 'OnColumn'; col.name = 'Date taken (local)'; col.label = 'Date taken (local)'; col.header = 'Date taken (local)'; col.justify = 'right'; col.defwidth = 6; col.autorefresh = 1; col.autogroup = true; col.type = 'datetime'; } function OnColumn(scriptColData) { var dt = scriptColData.item.metadata.image.datetaken; var isDate = DOpus.Typeof(dt) == 'object.Date'; scriptColData.columns('Date taken (UTC)').value = isDate ? dt.ToUTC() : ''; // scriptColData.columns('Date taken (local)').value = isDate ? dt.ToUTC().FromUTC() : ''; scriptColData.columns('Date taken (local)').value = isDate ? dt.Format('D#yyyy-MM-dd T#HH:mm:ss') : ''; }