Jump to content

Outputting date in months and days only into a string

- - - - -

  • Please log in to reply
1 reply to this topic

#1
Aspiring Coder

Aspiring Coder

    Newbie

  • Members
  • Pip
  • 1 posts
I have a code segment that looks like this:


private void Enter_Click(object sender, EventArgs e)
{
string name;
string date;
string answer;
name = nameInput.Text;
date = dateInput.Text;
answer = "NO";


outputLabel.Text = name + "'s birthday is " + date;
answerBox.Text = answer;
}
}
}


The bolded and underlined part is what needs changing. The code is just a crappy little program in which you input your name and your birthday, and it says wether or not that day is today, and it then displays YES or NO in monolithic letters. So far I've got it so it always changes to no, but how do I get it so that I can input a date into a text field, push the enter button then have it check the current date with the date entered in order to get it to output an answer into a string so I can make the monolithic letters appear? (C#, probably could have guessed that but there you go.)

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
String Format for DateTime [C#]
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users