DateTime

  • Thread starter Thread starter JD
  • Start date Start date
J

JD

Hello, i'm been trying to find out how to display a message on date, i know
how to do it in c++, but now i'm learning c# i'm having problems.

here is the code i'm using

using System; // has all the date/time stuff

class myApp

{

public static void Main()

{

DateTime CurrTime = DateTime.Today;

Console.WriteLine(CurrTime.Day);

Console.WriteLine(CurrTime.Month);





if (CurrTime.Day = "27" + CurrTime.Month ="10")

{

Console.WriteLine("Birthday");

}

else

{

Console.WriteLine("Not Birthday");

}

Console.ReadLine();

}

}



any advice would help, and thanks in advance
 
JD said:
Hello, i'm been trying to find out how to display a message on date, i know
how to do it in c++, but now i'm learning c# i'm having problems.

Well, the first problem is your "if" condition:

if (CurrTime.Day = "27" + CurrTime.Month ="10")

That should be:

if (CurrTime.Day==27 && CurrTime.Month==10)

(just as it would be in C#).
 
Back
Top