Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8400893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:39:56+00:00 2026-06-09T21:39:56+00:00

I want to show current date and time in my c++ program. I did

  • 0

I want to show current date and time in my c++ program. I did this simply by these lines of code:

char date[9], time[9];

_strdate( date );
_strtime( time );

cout << "Current date and time: " << date << " " << time << endl;

This perfectly worked in MS Visual C++ 2010 and Dev C++ 4.9.9.2. But this doesn’t work in Xcode! It says that I’m using undeclared identifiers ‘strdate’ and ‘strtime’. I have included iostream and ctime libraries, but this didn’t help. What’s the problem? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:39:58+00:00Added an answer on June 9, 2026 at 9:39 pm
    std::string _strdate_alternative()
    {
     char cptime[50];
     time_t now = time(NULL);
     strftime(cptime, 50, "%b. %d, %Y", localtime(&now)); //short month name
     return std::string(cptime);
    }
    

    As said before, there is no such function in standard c/c++ library.
    You can use this alternative. Code is based on some info found on the Internet. I didn’t compile it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to show the current time of any country. Suppose i want to
I want to show Build On date in About message box, current i'm using
When i run the program, the system current time is show in a textview.
I want to include the current time and date in a .net application so
I want to design a splash screen that can show the current loading process
i have created an application which show data from user current location. I want
I want to show array objects at the same time in different 10 labels.
I want to show my groupview with 2 lines to down direction, but only
is there any easy to validate a time field entry against the current date
My current time is 9:05 am. But if i print php date function like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.