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 6349641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:39:20+00:00 2026-05-24T21:39:20+00:00

I am reading a date from the db as a string. I want to

  • 0

I am reading a date from the db as a string. I want to break it down into integers so I can pass it to my Date constructor, so I used the following:

 int y,m,d;
sscanf(test,"%d-%d-%d",&y,&m,&d);
cout<<"date is: "<<y<<"-"<<m<<"-"<<d<<"\n";
Date cdr;
    cdr=Date(d,m,y);
    setDate(cdr);
cout<<"cdr is "<<cdr.getDay();//this is returning 0

and here’s the getDay()

inline int getDay(void) const {return d_;}

the problem is the cout shows the integers fine, but when I pass these to my Date constructor
the output shows a bunch of numbers like this:
1176523603-1162761289-1176531567

can you help me fix this…thx!

  • 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-24T21:39:21+00:00Added an answer on May 24, 2026 at 9:39 pm

    Looking at the Date class posted in the comments above the error is here

    class Date
    {
    ...
    Date(const Date& dd){}
    Date& operator=(const Date&){}
    ...
    };
    

    Delete both of those methods and the code might work.

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

Sidebar

Related Questions

I want to format a date from a string. I can do it this
I have a date I'm reading from an API in the following format: 2010-03-15T00:00:00-04:00
I am reading in a String from a text file which contains a date
I'm reading a date from an Excel cell in Python (using .Value on the
How can i map a date from a java object to a database with
I have a query reading a date from a parent/child relationship and i need
I'm writing a date/time value to an XML file by reading the date from
I am working on a IMAP, so just reading the body (body[header.fields (DATE FROM
i am currently reading in a list of files from different directories into a
I am reading a date column from the Oracle DB. The column type is

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.