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

  • Home
  • SEARCH
  • 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 728165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:39:00+00:00 2026-05-14T06:39:00+00:00

Is there an easy beginner way to take the current time using <ctime> to

  • 0

Is there an easy “beginner” way to take the current time using <ctime> to a Date object that has

int month
int day
int year

for it’s member variables? Thanks.

  • 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-05-14T06:39:00+00:00Added an answer on May 14, 2026 at 6:39 am
    time_t tt = time(NULL); // get current time as time_t
    struct tm* t = localtime(&tt) // convert t_time to a struct tm
    cout << "Month "  << t->tm_mon 
         << ", Day "  << t->tm_mday
         << ", Year " << t->tm_year
         << endl
    

    The tm struct ints are all 0-based (0 = Jan, 1 = Feb) and you can get various day measures, day in month (tm_mday), week (tm_wday) and year(tm_yday).

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

Sidebar

Related Questions

How do I start using Mono in Linux as a beginner when I want
I'm a beginner in Objective-C and I'm trying to find the most convenient way
I am following some beginner tutorials for OpenGL in c++ but as I started
I have been struggling with Subversion for some time, thinking it was beginners problems
It's the same syntax in a way too many languages: switch (someValue) { case
I'm a beginner to intermediate programmer and I've learned some java and C#. I
I had been learning ERP applications this summer during internship. As I am a
( Edit : to clarify, my main goal is concurrency, but not necessarily for
I know Python (and a bunch of other languages) and I think it might

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.