RaouL_BennetH
07-03-2007, 14:47
Ciao a tutti :(
Allora, il mio problemuccio è questo.
Valori di tipo double (che poi vengono valutati in unità di tempo, per es.:
var1 = 18.00 var2 = 22.00
In base ad una semplice operazione (var2 - var1) mi da correttamente 4.00
Ora...
var1 = 22.00 var2 = 00.30
devo fare in modo che mi restituisca 2.30 (o 2.50)
Il codice che di sicuro posterete sul Daily Wtf è questo:
DateTime dt1, dt2;
bool b1, b2;
b1 = DateTime.TryParse(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(), out dt1);
b2 = DateTime.TryParse(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(), out dt2);
TimeSpan ts = dt2.Subtract(dt1);
dataGridView1.Rows[e.RowIndex].Cells[7].Value = ts.ToString();
Plz... :help:
Allora, il mio problemuccio è questo.
Valori di tipo double (che poi vengono valutati in unità di tempo, per es.:
var1 = 18.00 var2 = 22.00
In base ad una semplice operazione (var2 - var1) mi da correttamente 4.00
Ora...
var1 = 22.00 var2 = 00.30
devo fare in modo che mi restituisca 2.30 (o 2.50)
Il codice che di sicuro posterete sul Daily Wtf è questo:
DateTime dt1, dt2;
bool b1, b2;
b1 = DateTime.TryParse(dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString(), out dt1);
b2 = DateTime.TryParse(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString(), out dt2);
TimeSpan ts = dt2.Subtract(dt1);
dataGridView1.Rows[e.RowIndex].Cells[7].Value = ts.ToString();
Plz... :help: