dear professors I'm new comer for the c++ language. So i like to study it like a professional person so i need a help can anyone tell how to format this 148 number to the date and month format. I tried to find the answer of this question searching lot of ways but i failed it please help me that question i hope someone give a good answer thank you!
When you type like this no one can understand you try to use punctuation also not everyone here is a professor just letting you know for future reference
As for your problem, you probably don't want to store a three digit number to represent the time and date.
@IWishIKnew sir i don't want format it as time and date
i need to format this three digits to month and date. please think like this.
148 is starting date of january first and ending then it the birth date like. did u got the mean?? bcz ma english is not well
Start with an array of days in each month: int months[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
(1) First work out which month you are in.
(2) then work out which day you are in.
As an example:
if you are converting day 100, then to end of each month will be:
ok, well, you'll only be able to store the months between january and september...
12 = max months...
I assume you're using a 2-digit year value (which is erroneous, by the way: remember "y2k"?).
You're gonna have to do a bit more to store dates than just 3-digit numbers.
hmm... you could try hex values though... (for the month, anyway...)
************************************************************
ah, I read shodan's post and now I know what you mean. You want to know the Nth day of the year as a date.
Simple:
calculate the date from january 1st, knowing the year, and the number of days in each month.