CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Comparing 2 dates

Print topic Send  topic

Author Message
klipkop

Posts: 16
Posted: 06/11/2007, 2:05 PM

Hi

I am battling to compare 2 datetime fields in C#. I have tried numerous solutions on the web.

Have two dates DueDate and now. IF DueDate is before Current date then the DueDate text should be red

Tried the following and keep getting errors on the compare:

if (DateTime.Compare(DataItem.DueDate.Value,DateTime.Now) < 0)
{
DataItem.DueDate.Text = "<b><font color='red'>" +
(DataItem.DueDate.Value).ToString() + "</b></font>";
}

Tried to declare two variables
DateTime DueDate = DataItem.DueDate.Value ;
/DateTime DateSys = DateTime();

IF (DueDate < dateSys)
Then ....

Errors - cant compare the two fiels

Then I did a DateTime.ConvertTo.String which some c# samples suggested. Then getting a error can't compare two strings with < or =

I you can see I am not acoder but I can help myself 90% of the time. Not on this one

Please help
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.