How do I change the data type of a column to Date from Text?
I have a column that has a date in it, but the date when imported was typed as Text. The current format is 1/29/2019 and typed as Text. I would like to change it to 01/29/2019 and typed as Date. How do I do this?
Yes, that is the correct compute function. The exact process is as follows:
1. Within Projects, look on the left hand side for the Tools Menu (a series of images). Click on the Compute button (6th button down from the top of the list, with a calculator for the image)
2. You will see a field where you can enter text (with a corresponding calculator icon to the left). If you click on the icon, you can scroll through the list until you find the function: DATEVALUE(). Alternatively, you can write the formula manually in the open field.
The DATEVALUE computed column converts a datetime text string to a datetime object. Enter the command with the following syntax*:
DATEVALUE(@colname@, FORMAT, TIME_ZONE)
*@colname@ is the field you wish to cast into a date value. FORMAT is format of the DATETIME. TIME_ZONE is the time zone you want associated with the datetime object.
The following is a sample: DATEVALUE(@Date@, "yyyy-MMM-dd hh:mm a", "GMT-05:00")
3. This will generate a new field (so your original field will remain in the dataset). You can tell if this was successful by:
Seeing a new field at the right of the dataset
The font color of the field is blue
The alignment is to the right
Date/time icon appears to the left of the field name