User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 422,825 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,301 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 3854 | Replies: 6
Reply
Join Date: Oct 2006
Location: Singapore
Posts: 13
Reputation: ReDeViL is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ReDeViL ReDeViL is offline Offline
Newbie Poster

Capture system date?

  #1  
Nov 18th, 2006
Hi ppl!

can anyone tell me how to capture system date and o/p it later in a prog??

what function do i use??

thanks in advance! appreciate any help rendered. :cheesy:
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 4,782
Reputation: iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light iamthwee is a glorious beacon of light 
Rep Power: 17
Solved Threads: 319
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Industrious Poster

Re: Capture system date?

  #2  
Nov 18th, 2006
Originally Posted by ReDeViL View Post
Hi ppl!

can anyone tell me how to capture system date and o/p it later in a prog??

what function do i use??

thanks in advance! appreciate any help rendered. :cheesy:


Time library?
I'm not a programmer. My attitude starts with ignorance, holds steady at conversation, and ends with a trip to the hospital. Get used to it.
Reply With Quote  
Join Date: May 2006
Posts: 2,719
Reputation: WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold WaltP is a splendid one to behold 
Rep Power: 15
Solved Threads: 222
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Maven

Re: Capture system date?

  #3  
Nov 18th, 2006
Originally Posted by iamthwee View Post
Time library?
Time Library.

Look into time(), asctime(), and related functions.
Age is unimportant -- except in cheese
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,116
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 38
Solved Threads: 929
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Most Valuable Poster

Re: Capture system date?

  #4  
Nov 18th, 2006
Originally Posted by iamthwee View Post
Time library?

all the functions in time.h
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Reply With Quote  
Join Date: Nov 2006
Posts: 7
Reputation: johnpeter1989 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
johnpeter1989 johnpeter1989 is offline Offline
Newbie Poster

Solution Re: Capture system date?

  #5  
Nov 19th, 2006
for dates, there is an inbuilt structure in dos.h

to get help in the cpp just get help on date

the date structure has just 3 items,day month and year.
there are in built functions to get current date
the following code will fill the structure item d1 with the current system date.

 
date d1;
getdate(&d1);
cout<<d1.da_year<<d1.da_day<<d1.da_mon;//display date


to know more about each data item in struct date just get help from your cpp program.
Reply With Quote  
Join Date: Oct 2006
Location: Singapore
Posts: 13
Reputation: ReDeViL is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
ReDeViL ReDeViL is offline Offline
Newbie Poster

Re: Capture system date?

  #6  
Nov 22nd, 2006
thanks for the help!!!
i got it!!!
Reply With Quote  
Join Date: Nov 2005
Location: Canada
Posts: 236
Reputation: dwks will become famous soon enough dwks will become famous soon enough 
Rep Power: 4
Solved Threads: 21
dwks's Avatar
dwks dwks is offline Offline
Posting Whiz in Training

Re: Capture system date?

  #7  
Nov 22nd, 2006
Originally Posted by johnpeter1989 View Post
for dates, there is an inbuilt structure in dos.h

to get help in the cpp just get help on date

the date structure has just 3 items,day month and year.
there are in built functions to get current date
the following code will fill the structure item d1 with the current system date.

 
date d1;
getdate(&d1);
cout<<d1.da_year<<d1.da_day<<d1.da_mon;//display date


to know more about each data item in struct date just get help from your cpp program.

Only very ancient compilers have dos.h. The ANSI-standard functions in <time.h> are a much better bet.
dwk

Seek and ye shall find.

"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.

"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison

"The only real mistake is the one from which we learn nothing."
-- John Powell
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb C++ Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 10:35 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC