Click here to Skip to main content
16,016,022 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 3:32
BadJerry18-Jul-12 3:32 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Software_Developer18-Jul-12 4:54
Software_Developer18-Jul-12 4:54 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 5:41
BadJerry18-Jul-12 5:41 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Richard MacCutchan18-Jul-12 7:39
mveRichard MacCutchan18-Jul-12 7:39 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
jschell20-Jul-12 7:28
jschell20-Jul-12 7:28 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Richard MacCutchan20-Jul-12 9:21
mveRichard MacCutchan20-Jul-12 9:21 
GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
Software_Developer18-Jul-12 21:12
Software_Developer18-Jul-12 21:12 
AnswerRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
krmed18-Jul-12 10:04
krmed18-Jul-12 10:04 
You can still use the ParseDateTime, but you need to set the format first.

Here's what I've done...

First, get the current format using
C++
GetLocaleInfo(m_LCID, LOCALE_SSHORTDATE, m_csOriginalSDateFormat.GetBuffer(MAX_PATH + 1), MAX_PATH);
m_csOriginalSDateFormat.ReleaseBuffer();
(m_csOriginalSDateFormat is a CString)

Next have your own CString with the desired format:
m_csNewSDateFormat = _T("M/d/yyyy");

Now, set the desired format, parse the date/time, and restore the original format:
SetLocaleInfo(m_LCID, LOCALE_SSHORTDATE, m_csNewSDateFormat);
oleStartTime.ParseDateTime(csDateTime);
SetLocaleInfo(m_LCID, LOCALE_SSHORTDATE, m_csOriginalSDateFormat);

Hope this helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

GeneralRe: ParseExact - parsing a date with a given format in C++ / MFC Pin
BadJerry18-Jul-12 22:45
BadJerry18-Jul-12 22:45 
GeneralRe: COleDateTime::Format("%A, %B %d, %Y") Pin
Software_Developer19-Jul-12 6:16
Software_Developer19-Jul-12 6:16 
GeneralRe: COleDateTime::Format("%A, %B %d, %Y") Pin
BadJerry19-Jul-12 7:08
BadJerry19-Jul-12 7:08 
Generalset focus to main dialog form in MFC (SOLVED) Pin
jawadali47717-Jul-12 18:05
jawadali47717-Jul-12 18:05 
AnswerRe: set focus to main dialog form in MFC Pin
Richard MacCutchan17-Jul-12 21:48
mveRichard MacCutchan17-Jul-12 21:48 
GeneralRe: set focus to main dialog form in MFC Pin
jawadali47717-Jul-12 22:00
jawadali47717-Jul-12 22:00 
Questionftp : to upload multile files at same time Pin
includeh1017-Jul-12 4:27
includeh1017-Jul-12 4:27 
QuestionRe: ftp : to upload multile files at same time Pin
David Crow17-Jul-12 9:59
David Crow17-Jul-12 9:59 
AnswerRe: ftp : to upload multile files at same time Pin
Peter_in_278017-Jul-12 18:16
professionalPeter_in_278017-Jul-12 18:16 
QuestionMoving file with progress Pin
sarfaraznawaz17-Jul-12 1:02
sarfaraznawaz17-Jul-12 1:02 
AnswerRe: Moving file with progress Pin
Malli_S17-Jul-12 1:43
Malli_S17-Jul-12 1:43 
QuestionRe: Moving file with progress Pin
Richard MacCutchan17-Jul-12 2:39
mveRichard MacCutchan17-Jul-12 2:39 
GeneralRe: Moving file with progress Pin
David Crow17-Jul-12 4:26
David Crow17-Jul-12 4:26 
GeneralRe: Moving file with progress Pin
sarfaraznawaz17-Jul-12 20:03
sarfaraznawaz17-Jul-12 20:03 
QuestionRe: Moving file with progress Pin
David Crow18-Jul-12 2:16
David Crow18-Jul-12 2:16 
QuestionAbout opengl screen shot is black Pin
wangningyu16-Jul-12 22:52
wangningyu16-Jul-12 22:52 
SuggestionRe: About opengl screen shot is black Pin
Richard MacCutchan16-Jul-12 23:29
mveRichard MacCutchan16-Jul-12 23:29 

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.