Sep 24, 2001 #1 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!
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!
Jan 16, 2002 #2 SashaBuilder3 Programmer Jan 13, 2002 131 CA 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("day=%d, month=%d, year=%d\n",today.da_day, today.da_mon,today.da_year); getch(); } Upvote 0 Downvote
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("day=%d, month=%d, year=%d\n",today.da_day, today.da_mon,today.da_year); getch(); }
Jan 16, 2002 #3 DoNotEven Programmer Dec 21, 2000 89 US 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 Upvote 0 Downvote
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