Skip to main content
Known Participant
Jun 14, 2022 12:01 PM UTC
Question

Convert string to datetime mysql

HI Team,

Can anyone guide me how to convert "11 May 2021 07:08:12 GMT" of type varchar to DateTime type in mysql.

I have a column of timestamp of type varchar as I am dumping data directly from csv.

I need to do some group by and min , max based on data type datetime on this field.

Please guide 

Regards

Bihitak

    4 replies

    gopalk2865
    Participating Frequently
    Jun 14, 2022 12:26 PM UTC

    Hi, You can use convert() function probably once you are doing in db.one more thing you can do is, Before dumping it to db table , format the column as well into date time from string. In this case you wont have to convert in DB.

    mikes0011
    Brainy
    Jun 14, 2022 12:46 PM UTC

    Can you clarify - do you need to do this conversion in SQL itself or can it be converted in Appian before being passed to the DB?  If it can be parsed in Appian, it would be pretty straightforward to build a parser rule that breaks up the timestamp string into component parts and feeds it into a rule like "datetime()", and returns an Appian Date/Time value.

    The Expression Guru
    Known Participant
    Jun 14, 2022 1:52 PM UTC

    Thanks , I want to do at DB side as I am using CSV import smart service to import all the data in siting format

    mikes0011
    Brainy
    Jun 14, 2022 2:36 PM UTC

    I assume there might be SQL functionality that can handle this, though it might be quite a bit harder.  That question might be best answered by looking into external SQL reference sites, though.

    The Expression Guru