Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
time_t ltime; time( <ime ); tm * pTm = localtime(<ime); printf("%d",pTm->tm_wday);
output= 2 , how come while 2day is 8 -.- anyclue?
tm_wday is the weekday, indexed from 0 being Sunday, to 6 being Saturday.
tm_wday
It is 2 today because it's a Tuesday.
What you want to access for the day of the month is tm_mday.
tm_mday
struct tm
Add a comment
Because tm_wday is the day since Sunday. Therefore it is 2. What you want is tm_mday
http://www.cplusplus.com/reference/clibrary/ctime/tm/
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.