Date Type..

Hi

this could be a newbie question. I want to assign "12\12\1999" as a date
variable. Is it possible to assign this to type date or whether i have to pass   this to three variables and check for its validity. helps will be very much appreciated.

thanks
begin.
beginAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sreenathkCommented:
Which C++ is it? In VC++ there is such an option available.

Sreenath
0
KangaRooCommented:
Sreenath, I suppose you mean there are date and time classes in MFC.
There are some date and time functions in C also. Check your manual/helpfile for time.h. Look for the struct tm
0
dhymesCommented:
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

sreenathkCommented:
Yes Kangaroo, what you said is correct. What dhymes given also explains how cdate class is implemented. Basically we coming to the same conclusion that it is possible to have a date variable. But where is the initiator? Whether this satisfies him or not?

Sreenath
0
sumant032199Commented:
You can use following technic.
time and date are 16-bit structures divided into bit fields for
referring to the current date and time.

 time ¦15.....11¦10........5¦4.......0¦
      ¦---------+-----------+---------¦
        Hours     Minutes    Seconds/2

 date ¦15..........9¦8.....5¦4.......0¦
      ¦-------------+-------+---------¦
       Years since   Month     Day
           1980

If you want a simple code how to access these bit fields then simply make a comment.
0
sumant032199Commented:
You can use following technic.
time and date are 16-bit structures divided into bit fields for
referring to the current date and time.

 time ¦15.....11¦10........5¦4.......0¦
      ¦---------+-----------+---------¦
        Hours     Minutes    Seconds/2

 date ¦15..........9¦8.....5¦4.......0¦
      ¦-------------+-------+---------¦
       Years since   Month     Day
           1980

If you want a simple code how to access these bit fields then simply make a comment.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
beginAuthor Commented:
Yes sumant, i need to know about how to access dates using bit fields.
--begin
0
sumant032199Commented:
I am very sorry I neglected the entire question. I will give you now.
#define DD(date) (date & 0x1F)
#define MM(date) (date & 0x1E0) >> 5
#define YY(date) (date & 0xFE00)/0x200

#define SEC(time) (time & 0x1F)
#define MIN(time) (time & 0x7E0) >> 5
#define HR(time) (time & 0xF800) >> 11

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.