D
Darryn Ross
Hi,
I am having problems with some date comparisons.... i am not getting the
correct answer when doing DateTime.Compare(t1, t2) ;
I have a DataGrid full of records that i have bound using a currency manager
to a DataTable.
Records in the Datagrid can be edited added or deleted.
before i save the any modified transactions in the grid i validate each and
every one to enure they meet certain criteria, this is where my problem is
appearing. I compare the date in my transaction to a stored date i have to
see if it is within a valid range, however when i compare dates of the same
date the compare function is not returning 0 it is returning -1?? i cannot
understand what it is doing.. i have included a small snippet of my validate
function where the error is happening.
row 0 is my first row.
column 2 is my Date Column in my Grid.
dtValidate is a DateTime object.
dtValidate = Convert.ToDateTime(datagrid[0, 2]) ;
//The calculation error occurs here..
i = DateTime.Compare(dtValidate, DateStart) ; // This should return 0 but it
returns -1 both dates are exactly the same?? {07/01/2004} "MM/dd/yyy"
Any help would be appreciated...
Regards
Darryn
I am having problems with some date comparisons.... i am not getting the
correct answer when doing DateTime.Compare(t1, t2) ;
I have a DataGrid full of records that i have bound using a currency manager
to a DataTable.
Records in the Datagrid can be edited added or deleted.
before i save the any modified transactions in the grid i validate each and
every one to enure they meet certain criteria, this is where my problem is
appearing. I compare the date in my transaction to a stored date i have to
see if it is within a valid range, however when i compare dates of the same
date the compare function is not returning 0 it is returning -1?? i cannot
understand what it is doing.. i have included a small snippet of my validate
function where the error is happening.
row 0 is my first row.
column 2 is my Date Column in my Grid.
dtValidate is a DateTime object.
dtValidate = Convert.ToDateTime(datagrid[0, 2]) ;
//The calculation error occurs here..
i = DateTime.Compare(dtValidate, DateStart) ; // This should return 0 but it
returns -1 both dates are exactly the same?? {07/01/2004} "MM/dd/yyy"
Any help would be appreciated...
Regards
Darryn