If you are inserting into a database don't use a Date String. Use a Parameter Object and give the Value the date object.
for access
string mystatment = "Insert into TableName (column1, datecolumn) values (?,?)"
OleDbCommand cmd = conn.CreateCommand();
cmd.Commandtext = mystatement;
cmd.Parameters.AddWithValue("@column1", mycolumn1variable);
cmd.Parameters.AddWithValue("@datecolumn", yourDateTimeVariable);
if you are properly doing this with production code make sure you have exception handling etc.
using (OleDbConnection conn = new OleDbConnection("connection string"))
{
using (OleDbCommand cmd = conn.CreateCommand())
{
cmd.CommandText = "Insert into TableName (column1, datecolumn) values (?,?)";
OleDbParameter param;
param = new OleDbParameter("name", OleDbType.VarChar, 36); // if you know the size of the column specify it
param.Value = mycolumn1variable;
cmd.Parameters.Add(param);
param = new OleDbParameter("mydate", OleDbType.Date); // if you know the size of the column specify it
param.Value = yourDateTimeVariable;
cmd.Parameters.Add(param);
conn.Open();
cmd.ExecuteNonQuery(); //etc
}
}
for sql you use the named @parameters instead of the ? in your statement and use a SqlCommand instead.
If it's for screen display, repect the users settings and format based on their culture.