6 Replies - 10140 Views - Last Post: 12 April 2007 - 01:12 PM Rate Topic: -----

#1 new2programs  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 10-April 07

Input a date

Posted 11 April 2007 - 06:49 PM

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.
Is This A Good Question/Topic? 0
  • +

Replies To: Input a date

#2 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

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
Was This Post Helpful? 0
  • +
  • -

#3 new2programs  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 10-April 07

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?
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 248
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Input a date

Posted 12 April 2007 - 10:30 AM

Topics merged for continuity. Did you take a look at the links above?
Was This Post Helpful? 0
  • +
  • -

#5 new2programs  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 10-April 07

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!
Was This Post Helpful? 0
  • +
  • -

#6 new2programs  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 10-April 07

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.
Was This Post Helpful? 0
  • +
  • -

#7 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1