4 Replies - 13720 Views - Last Post: 29 August 2012 - 05:39 AM Rate Topic: -----

#1 beberenne  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-October 06

How to display current date without displaying time? urgent

Posted 31 October 2006 - 05:13 AM

I have finish my whole C++ assignment except for one part which i have to output my current date using ctime but without the time.
here are my codes:

#include <ctime>
time_t rawtime;
time ( &rawtime );
cout<<???

hope someone can help. assignment due tomorow.Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: How to display current date without displaying time? urgent

#2 Xing  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 19
  • View blog
  • Posts: 725
  • Joined: 22-July 06

Re: How to display current date without displaying time? urgent

Posted 31 October 2006 - 06:30 AM

View Postbeberenne, on 31 Oct, 2006 - 05:43 PM, said:

I have finish my whole C++ assignment except for one part which i have to output my current date using ctime but without the time.
here are my codes:

#include <ctime>
time_t rawtime;
time ( &rawtime );
cout<<???

hope someone can help. assignment due tomorow.Thanks


#include <iostream>
#include <ctime>

int main ()
{
  char date [10];
  _strdate(date);
  std::cout<<"Current Date:"<<date;
  return 0;
}


Was This Post Helpful? 1

#3 beberenne  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 23-October 06

Re: How to display current date without displaying time? urgent

Posted 31 October 2006 - 06:55 AM

Thanks. It worked perfectly.
Was This Post Helpful? 0
  • +
  • -

#4 bvipul1995  Icon User is offline

  • New D.I.C Head

Reputation: -2
  • View blog
  • Posts: 2
  • Joined: 29-August 12

Re: How to display current date without displaying time? urgent

Posted 29 August 2012 - 05:36 AM

View Postbeberenne, on 31 October 2006 - 05:13 AM, said:

I have finish my whole C++ assignment except for one part which i have to output my current date using ctime but without the time.
here are my codes:

#include <ctime>
time_t rawtime;
time ( &rawtime );
cout<<???

hope someone can help. assignment due tomorow.Thanks
[code]
#include <ctime.h>
time_t rawtime;
time ( &rawtime );
cout<<ctime(&rawtime);
getch();
[\code]

Was This Post Helpful? -1
  • +
  • -

#5 jimblumberg  Icon User is offline

  • member icon


Reputation: 4006
  • View blog
  • Posts: 12,361
  • Joined: 25-December 09

Re: How to display current date without displaying time? urgent

Posted 29 August 2012 - 05:39 AM

Please stop opening topics from several years ago.

If you have a question then open a new topic and ask your question.

Jim

This post has been edited by jimblumberg: 29 August 2012 - 05:40 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1