Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 18-11-2009
Member
 
Join Date: May 2008
Posts: 68
How to accept Date of Birth with specific format in C?

Hi, I want to know how to take any birth date from user in the format at which you want in C programming language? Can anyone suggest me any solution? I want to take value in the format which I want. If you have any code please forward me.
Reply With Quote
  #2  
Old 18-11-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: How to accept Date of Birth with specific format in C?

Hi, I want to know that in which format you want answer actually. I am not getting the format means. Just make it clear. Are you wanted to take the value of birth date in the format such as 18 November,2009 or in the format such as dd/mm/yyyy ? Just make it clear what you want. I am waiting for your reply. I will reply you immediately, just make me clear what you want exactly. OK.
Reply With Quote
  #3  
Old 18-11-2009
Member
 
Join Date: May 2008
Posts: 2,008
Re: How to accept Date of Birth with specific format in C?

Hello, In which format you want to take output exactly? I am giving you two if you want something different then just reply me. If you want date in the format of 5 November,2008 then you need to use

int day,month,year;
scanf("%d %d, %d",&day,&month,&year);


and if you want date in the format of dd/mm/yyyy then you need to use

int day,month,year;
scanf("%d/%d/%d",&day,&month,&year);


Change it as per your requirement.
Reply With Quote
  #4  
Old 18-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: How to accept Date of Birth with specific format in C?

Hi, I am providing you the format which you need to change as per your specification as you did not explain the format you want as an output. Just, take a look at the format, understand it and then just try to make it as you want in your output. I will just suggest you understand it, so it will help you to achieve what you want.

int dd ,mm ,yy;
scanf("%d %d %d",&dd,&mm,&yy);

Now you get output depending on what you are taking from the user. If you are getting all numbers then set your variables as int. If you want your month would be displayed as string then set it as string and so.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to accept Date of Birth with specific format in C?"
Thread Thread Starter Forum Replies Last Post
How to add birth date details in Nokia E5 FunnyBHUSAN Portable Devices 4 11-04-2011 10:57 AM
Using date format in JSP KAMANA Software Development 6 29-07-2010 10:32 AM
Problem in date format Vodka Software Development 5 19-02-2010 04:38 AM
Changing the date format Uzair Customize Desktop 3 03-04-2009 12:44 PM
DSQUERY: list users created after a specific date AndieB Active Directory 2 27-11-2008 01:05 AM


All times are GMT +5.5. The time now is 10:55 AM.