Hey guys, I'm figuring out how I can convert an ISO 8601 to a standard DateTime like dd/mm/yyyy.
The string is:
And I'd want it to show it like so:
I'm storing this in an SQLite Database and the code I use to store everything:
the Visual aspect is that I use a datagridview to see the data, so the conversion would have to happen while I read and store the data in the database.
Any help would be appreciated.
Michael
The string is:
Code:
2013-01-03T00:00:00.0000000Z
Code:
03-01-2013
Code:
conn.Open();
command.Connection = conn;
command.CommandText = "insert into Test ([Date], [LogName], [Channel], [DateRecord], [SizeInBytes]) values" + "(@Date, @LogName, @Channel, @DateRecord, @SizeInBytes)";
command.Parameters.Add("@Date", DbType.String);
command.Parameters.Add("@LogName", DbType.String);
command.Parameters.Add("@Channel", DbType.String);
command.Parameters.Add("@DateRecord", DbType.DateTime);
command.Parameters.Add("@SizeInBytes", DbType.Int64);
foreach (DataGridViewRow row in dgvTable.Rows)
{
if (!row.IsNewRow)
{
command.Parameters["@Date"].Value = row.Cells[0].Value;
command.Parameters["@LogName"].Value = row.Cells[1].Value;
command.Parameters["@Channel"].Value = row.Cells[2].Value;
command.Parameters["@DateRecord"].Value = row.Cells[3].Value;
command.Parameters["@SizeInBytes"].Value = row.Cells[4].Value;
command.ExecuteNonQuery();
btnGetDB.Enabled = false;
btnOpenLog.Enabled = false;
txtFilterChannel.Enabled = false;
txtFilterDate.Enabled = false;
txtFilterLog.Enabled = false;
Application.DoEvents();
}
command.CommandType = CommandType.Text;
}
Any help would be appreciated.
Michael
Comment