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#).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top