Skip to main content
Answer

Change Attribute from Text to Datetime field

  • February 20, 2024
  • 1 reply
  • 100 views

When we had some attributes created 2 of our date fields were created using Text rather than DateTime

I have been through some articles mentioning using CDATE, however I have not been able to get this to work yet. The final aim is to be able to sort by Contract End date DESC in the Customers GI.

Is there a way to do this without recreated the fields?

 

Best answer by darylbowman

Is there a way to do this without recreated the fields?

Yes and no.

You should be able to convert a correctly formatted string to a date with CDate(), but since you have no validation on your field, anyone could enter anything, therefore probably giving you errors when attempting to convert.

You could create new date attributes and attempt to copy the values from the current string attributes to the new date attributes, but this is magnificently complex.

1 reply

darylbowman
Captain II
Forum|alt.badge.img+15
  • Answer
  • February 20, 2024

Is there a way to do this without recreated the fields?

Yes and no.

You should be able to convert a correctly formatted string to a date with CDate(), but since you have no validation on your field, anyone could enter anything, therefore probably giving you errors when attempting to convert.

You could create new date attributes and attempt to copy the values from the current string attributes to the new date attributes, but this is magnificently complex.