Link to home
Create AccountLog in
Avatar of amillyard
amillyardFlag for United Kingdom of Great Britain and Northern Ireland

asked on

datediff between datetime variables

I am trying to work out the number of days difference between two dates (script attached)

e.Row.Cells[4].Text == is formatted as :  {0:dd-MMM-yy}
e.Row.Cells[6].Text == is formatted as :  {0:dd-MMM-yy  HH:mm}


Int32 dayDiff = Convert.ToDateTime(e.Row.Cells[4].Text).Day - Convert.ToDateTime(e.Row.Cells[6].Text).Day;

Open in new window

SOLUTION
Avatar of ee_rlee
ee_rlee
Flag of Philippines image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of amillyard

ASKER

ee_rlee:  is this visual basic code?   I am using c#. the DateDiff(DateInterval ...   not recognised by compiler
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ee_rlee:   ROUND is not compiling
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account