Visit the official Paxata Documentation portal for all of your doc needs.

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?

Best Answer

  • cjmaddoxcjmaddox Posts: 2 mod
    Accepted Answer
    Actually, I easily found the answer in Help Shelf and using DATEVALUE under Compute (computed columns). Thanks!
    Did this answer the question?

Answers

  • jmayhewjmayhew Posts: 26 admin
    edited January 31, 2019 6:29AM
    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*:
    *@[email protected] ;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(@[email protected], "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
Sign In or Register to comment.