Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hi i need to get the system da

Status
Not open for further replies.

Teepe

Programmer
Sep 24, 2001
1
CA
hi


i need to get the system date in c++

and i need to return that in a structure

somebody can tell me how i can do that?


thanks!

 
Try this.


#include <dos.h>
#include<conio.h>
#include<stdio.h>


struct date dateFunc()
{
struct date d;

getdate(&d);

return d;
};

void main()
{
struct date today;

today=dateFunc();

printf(&quot;day=%d, month=%d, year=%d\n&quot;,today.da_day, today.da_mon,today.da_year);

getch();
}
 
This example uses a label and a button on a form. When the user clicks the button, the current date is displayed in the caption of the label:

void __fastcall TForm1::Button1Click(TObject *Sender)

{
Label1->Caption = DateToStr(Date());
}

Hope this helps.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top