Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15136

Parse date to correct format

$
0
0
Hi

I have the following code to save file info in a data table to a mysql database table via an adapter:
Code:

With cmd2.Parameters
    .Add("@Name", MySqlDbType.VarChar, 50, "Name")
    .Add("@LastWriteTime", MySqlDbType.DateTime, "LastWriteTime")
End With

My issue is with LastWriteTime. The format in the datatable is dd/MM/yyyy HH :mm:ss (eg. 02/07/2021 14:51:57). I know Mysql accepts date in yyyy-MM-dd format. I obviously have to Parse or TryParse in the above. After a lot of searching, I just cannot figure out how to apply it.

Any help would be much appreciated.

Viewing all articles
Browse latest Browse all 15136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>