Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, Guys, I hope you all will be fine. Well I am a facing an issue nowadays in my project that is I want to know How to subtract Datagridview Column Time and system current time in c#
for example, if I put time 3:20:02 in data grid view columns and after 15 minutes when I check data grid view so current time will be 3:35.02 I want to minus this time and wanna get value in another data grid view column like 00:15:00.
Thanks

What I have tried:

datagridview1.row.cell[1] = datagridview1.Row.cell[0].value - system.datetime.now.tostring();
Posted
Updated 13-Jun-17 15:01pm

I would setup a variable to be of type System.DateTime then assign the datagridview cell value to it, then do something like variable = System.DateTime.Now - variable
then I would assign it to the new cell location with something like datagridview1.row.cell[1] = variable.ToString();
 
Share this answer
 
you can convert to timestamp

June 14, 2017 = 1497401466

June 13, 2017 = 1497315066

var resu = 1497401466 - 1497315066;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900