c++ functions to enumerate days for a month?

T

TOMERDR

Hi,
I am creating a simple calander application,
user can enter a date,and i will create a calender for the month which
contain the date
which is the function that get the month part of a date?
which is the function to get the days for a month?

Thanks in advance
 
P

phlip

TOMERDR said:
which is the function that get the month part of a date?
which is the function to get the days for a month?

Open your time.h file, and research time(), mktime(), and localtime().
 
O

osmium

TOMERDR said:
I am creating a simple calander application,
user can enter a date,and i will create a calender for the month which
contain the date
which is the function that get the month part of a date?
which is the function to get the days for a month?

If I were in your place I would write my own functions for both of those.

Doing so is instructive and fun and should give you a feel for what
programming is like.

In the US the conventional form for a date is mm dd yyyy. So the month part
is the first field the user types.
 
H

Howard

TOMERDR said:
Hi,
I am creating a simple calander application,
user can enter a date,and i will create a calender for the month which
contain the date
which is the function that get the month part of a date?
which is the function to get the days for a month?

Thanks in advance

It all depends on how you allow the users to enter the date. There are
various possible formats. For example (in the US), "09/27/06",
"09/27/2006", "Sept. 27, 2006", "September 27, 2006", and "27 Sep 2006" are
all ways to specify the 27th of September of this year. I believe there are
some functions in time.h which might help (but I don't know them
personally). Various functions might also be provided by your operating
system or compiler. Or you could write your own "parser" to break the
string into its parts, either according to rules you specify or according to
some kind of format string such as that which printf uses. It's really up
to you. If you need more help, you'll need to be more specific.

-Howard
 
J

Jonathan Mcdougall

TOMERDR said:
Hi,
I am creating a simple calander application,
user can enter a date,and i will create a calender for the month which
contain the date
which is the function that get the month part of a date?
which is the function to get the days for a month?

Support for dates and times in standard C++ is quite small, you may be
better served by Boost.Date_Time (www.boost.org). You can also check in
the <ctime> standard header (http://tinyurl.com/6u87b).


Jonathan
 

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

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,691
Members
48,796
Latest member
Greg L.

Latest Threads

Top