Click here to Skip to main content
15,908,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSDI and dialog communication Pin
lamrinraj10-May-11 18:33
lamrinraj10-May-11 18:33 
AnswerRe: SDI and dialog communication Pin
Hans Dietrich10-May-11 19:37
mentorHans Dietrich10-May-11 19:37 
GeneralRe: SDI and dialog communication Pin
lamrinraj10-May-11 22:47
lamrinraj10-May-11 22:47 
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 
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 
Date/times held in strings are no good for doing calculations, they are only good at interfacing to humans.

Use the time_t type, it basically is the number of seconds since 01-JAN-1970.
Once you have two time_t values, you can simply subtract them and compare to some constant, such as 7*24*60*60.

[ADDED]
POSIX has a nice strptime() function to turn a datetime string into a number; Windows itself hasn't (MFC has, boost has); so your best option may well be:
- use sscanf to turn the string into struct tm; here[^] is an example that should work, provided the month is by number, not by name.
- use mktime to turn that into a time_t
- then either use difftime or simply subtract.
[/ADDED]

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

modified on Tuesday, May 10, 2011 6:27 PM

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 

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.