Is there a way to input a date in the format you want using a one line.like in a console application. u have a writeline statement to input date in the form dd/mm/yyyy.
Input a date
Page 1 of 16 Replies - 8514 Views - Last Post: 12 April 2007 - 01:12 PM
Replies To: Input a date
#2
Re: Input a date
Posted 11 April 2007 - 07:28 PM
Do you want to simply take input from the user, or force the user to use a specific format, or take what the user has given and manipulate it into a specific format? Or are you asking about using the DateTime object?
http://www.daniweb.c...snippet184.html
http://msdn2.microso...m.datetime.aspx
http://www.geekpedia...ime-object.html
http://www.daniweb.c...snippet184.html
http://msdn2.microso...m.datetime.aspx
http://www.geekpedia...ime-object.html
#3
Re: Input a date
Posted 12 April 2007 - 10:17 AM
how can i input a date in the format dd/mm/yyyy (in one line, say console.writeline("enter date in format dd/mm/yyyy")).
Also i need to take the date, month and year to further use it in my program to find what day it was. I have written teh program but i can only take in date , month and year separately. is there a way to input date as 15/04/2004?
Also i need to take the date, month and year to further use it in my program to find what day it was. I have written teh program but i can only take in date , month and year separately. is there a way to input date as 15/04/2004?
#4
Re: Input a date
Posted 12 April 2007 - 10:30 AM
Topics merged for continuity. Did you take a look at the links above?
#5
Re: Input a date
Posted 12 April 2007 - 12:03 PM
Yes i did,
the user inputs a date in the format mm/dd/yyyy
and i have to take the month, date and year from teh user input and according use it in my program. your links helped. thanks!
the user inputs a date in the format mm/dd/yyyy
and i have to take the month, date and year from teh user input and according use it in my program. your links helped. thanks!
#6
Re: Input a date
Posted 12 April 2007 - 12:12 PM
Yes, I did.
Actually I have to write a proram in C# where the user gives in any random date afte 1980 and i have to figure what day of teh week it is.Its a console application. and can only use switch statements, for loops and all.
Actually I have to write a proram in C# where the user gives in any random date afte 1980 and i have to figure what day of teh week it is.Its a console application. and can only use switch statements, for loops and all.
#7
Re: Input a date
Posted 12 April 2007 - 01:12 PM
Store the input as a string and then use Substring method to extract the data and convert it into numerical format.
Then to determine which day of the week, the date entered falls on, use the formula found at the following link to determine which day of the week it is.
How to determine which day of the week it is from a date.
Then to determine which day of the week, the date entered falls on, use the formula found at the following link to determine which day of the week it is.
How to determine which day of the week it is from a date.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|