String to Date

String to Date

I have an entity attribute marked with Date data-type. My client needs an import feature for the project. Upon importing the data from a excel file, as per the client the data can be of non-Date format.

Any idea on how am I supposed to insert a String value as a Date type into the database?

1. You can use a String attribute and an if to show as Date or as String (data conversion functions TextToDateValidate() and TextToDate() )

if TextToDateValidate(attribute)
Show TextToDate(attribute)
Else
Show attribute

Case 2.
using two separate fields, date attribute and string attribute. When the value is not a Date, save value into String attribute and a Null Date . If is a Date, save into Date attribute and a Null String.

if dateattribute=NullDate()
Show stringattribute
else
Show dateattribute