Skip to main content
June 14, 2022
Question

Convert string to datetime mysql

  • June 14, 2022
  • 4 replies
  • 0 views

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
    June 14, 2022

    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
    June 14, 2022

    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
    June 14, 2022

    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
    June 14, 2022

    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