将有关字段日期时间的 Pre 和 Post 图像设置为字段文本

Set Pre and Post image about Field Date time to fields Text

我有 DateTime 类型的字段,我想在插件的图像中设置它的值,在预图像中设置值,更新后在 Post 图像中设置更新值。

母表单字段类型DateTime和子表单包含2个字段(旧值字段类型文本字符串和第二个字段新值类型文本字符串)

if (customerDataPreImage.Contains("ph_releasedate"))
{
     customerHistory["ph_oldreleasedate"] = Convert.ToDateTime(customerDataPreImage.Attributes["ph_releasedate"]);
}
if (customerDataPostImage.Contains("ph_releasedate"))
{
     customerHistory["ph_newreleasedate"] = Convert.ToDateTime(customerDataPostImage.Attributes["ph_releasedate"]);
}

将字段类型更改为日期时间并使用此代码现在可以正常工作

if (customerDataPreImage.Contains("ph_releasedate")) {
    customerHistory["ph_oldreleasedate2"] = customerDataPreImage.Attributes["ph_releasedate"];
}
if (customerDataPostImage.Contains("ph_releasedate")) {
    customerHistory["ph_newreleasedate2"] = customerDataPostImage.Attributes["ph_releasedate"];
}