G
Guest
I have 2 strings, "12/28/2005" and "16:44:54". I need to conatenate them and
convert them to datetime format so I can assign them to a datetime field in a
datarow. The time is now being converted to the date "12/28/2005". and I
don't know how to concatenate them since "+" won't work after I convert them.
Thanks, Alpha
if (result == "00")
{
char[] separator = {','};
char[] intSep = {'.'};
string lastDate, lastTime, lastMilleage;
DataRow drVeh = dsVehicle.Tables["VehDetail"].Rows[VListing.CurrentRowIndex];
DialogResult msgRet;
string[] replySeparated = ATSReply.Split(separator);
lastDate = replySeparated[2];
lastTime = replySeparated[3];
lastMilleage = replySeparated[4];
lastMilleage = lastMilleage.Substring(0, lastMilleage.Length - 3);
string[] intLastMilleage = lastMilleage.Split(intSep);
msgRet = MessageBox.Show("Would you like to update the vehicle odometer to
" + lastMilleage +
" and the last odometer read date to " + lastDate + " and the read time to
" +
lastTime, "Live Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(msgRet == DialogResult.Yes)
{
DateTime DatelastDate = Convert.ToDateTime(lastDate);
DateTime TimeLastTime = Convert.ToDateTime(lastTime);
// DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDate"] = DatelastDate;
drVeh["LastOdometerReading"] = Convert.ToInt32(intLastMilleage[0]);
drVeh.EndEdit();
}
}
convert them to datetime format so I can assign them to a datetime field in a
datarow. The time is now being converted to the date "12/28/2005". and I
don't know how to concatenate them since "+" won't work after I convert them.
Thanks, Alpha
if (result == "00")
{
char[] separator = {','};
char[] intSep = {'.'};
string lastDate, lastTime, lastMilleage;
DataRow drVeh = dsVehicle.Tables["VehDetail"].Rows[VListing.CurrentRowIndex];
DialogResult msgRet;
string[] replySeparated = ATSReply.Split(separator);
lastDate = replySeparated[2];
lastTime = replySeparated[3];
lastMilleage = replySeparated[4];
lastMilleage = lastMilleage.Substring(0, lastMilleage.Length - 3);
string[] intLastMilleage = lastMilleage.Split(intSep);
msgRet = MessageBox.Show("Would you like to update the vehicle odometer to
" + lastMilleage +
" and the last odometer read date to " + lastDate + " and the read time to
" +
lastTime, "Live Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(msgRet == DialogResult.Yes)
{
DateTime DatelastDate = Convert.ToDateTime(lastDate);
DateTime TimeLastTime = Convert.ToDateTime(lastTime);
// DateTime lastDateTime = DatelastDate + TimeLastTime;
drVeh["LastOdometerDate"] = DatelastDate;
drVeh["LastOdometerReading"] = Convert.ToInt32(intLastMilleage[0]);
drVeh.EndEdit();
}
}