Click here to Skip to main content
15,883,996 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: SDI and dialog communication Pin
JohnCz14-May-11 12:03
JohnCz14-May-11 12:03 
QuestionDesign Pattern of separating data and business logic Pin
Berlus10-May-11 10:44
Berlus10-May-11 10:44 
AnswerRe: Design Pattern of separating data and business logic Pin
_AnsHUMAN_ 10-May-11 18:21
_AnsHUMAN_ 10-May-11 18:21 
AnswerRe: Design Pattern of separating data and business logic Pin
ShilpiP10-May-11 20:07
ShilpiP10-May-11 20:07 
QuestionCompletely custom Edit control Pin
csrss10-May-11 8:56
csrss10-May-11 8:56 
AnswerRe: Completely custom Edit control Pin
Chris Losinger10-May-11 9:45
professionalChris Losinger10-May-11 9:45 
GeneralRe: Completely custom Edit control Pin
csrss10-May-11 11:37
csrss10-May-11 11:37 
Questionfind diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 6:54
quartaela10-May-11 6:54 
hi friends i am trying to find the contacts who have a birthday in the next 7 days in my list. i managed get the current time as a string but i am stucked here. i know i must compare only number of the month and day. so use subtraction and if the result is <=7 i will show the contact. but i don't know how to do this. i appreciated if you can help me. and here is the my example code.
#include <stdio.h>
#include <time.h>
#include <string.h>

int main( )
{
    char buff[11];
    char birth[11]="2011-05-15";
    
    int res;
    
    time_t now = time(NULL);
    strftime(buff, 20, "%Y-%m-%d\n", localtime(&now));
    
             
             res = difftime(mktime(birth), now);
		  
		  printf("%d", res);
		  
		 return 0;
}

AnswerRe: find diffrence between current time and birthday as a number of days. Pin
Chris Losinger10-May-11 7:43
professionalChris Losinger10-May-11 7:43 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 7:47
quartaela10-May-11 7:47 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Chris Losinger10-May-11 7:51
professionalChris Losinger10-May-11 7:51 
AnswerRe: find diffrence between current time and birthday as a number of days. Pin
Richard MacCutchan10-May-11 7:54
mveRichard MacCutchan10-May-11 7:54 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 8:04
quartaela10-May-11 8:04 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Richard MacCutchan10-May-11 8:32
mveRichard MacCutchan10-May-11 8:32 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 11:57
quartaela10-May-11 11:57 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Richard MacCutchan10-May-11 12:03
mveRichard MacCutchan10-May-11 12:03 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 12:46
quartaela10-May-11 12:46 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Richard MacCutchan10-May-11 13:03
mveRichard MacCutchan10-May-11 13:03 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela10-May-11 14:41
quartaela10-May-11 14:41 
QuestionRe: find diffrence between current time and birthday as a number of days. Pin
David Crow10-May-11 15:32
David Crow10-May-11 15:32 
AnswerRe: find diffrence between current time and birthday as a number of days. [modified] Pin
Luc Pattyn10-May-11 8:16
sitebuilderLuc Pattyn10-May-11 8:16 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Ram Shelke10-May-11 19:53
Ram Shelke10-May-11 19:53 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
Le@rner10-May-11 21:11
Le@rner10-May-11 21:11 
GeneralRe: find diffrence between current time and birthday as a number of days. Pin
quartaela11-May-11 10:57
quartaela11-May-11 10:57 
AnswerRe: find diffrence between current time and birthday as a number of days. Pin
Luc Pattyn11-May-11 0:05
sitebuilderLuc Pattyn11-May-11 0:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.