Click here to Skip to main content
15,891,316 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionCould you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
6530573371-Sep-07 10:07
6530573371-Sep-07 10:07 
AnswerRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
Luc Pattyn1-Sep-07 12:15
sitebuilderLuc Pattyn1-Sep-07 12:15 
QuestionRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
6530573372-Sep-07 3:32
6530573372-Sep-07 3:32 
AnswerRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
Luc Pattyn2-Sep-07 3:54
sitebuilderLuc Pattyn2-Sep-07 3:54 
GeneralRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
Mark Salsbery2-Sep-07 9:58
Mark Salsbery2-Sep-07 9:58 
NewsRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
6530573373-Sep-07 1:03
6530573373-Sep-07 1:03 
GeneralRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
Luc Pattyn3-Sep-07 5:23
sitebuilderLuc Pattyn3-Sep-07 5:23 
GeneralRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
Mark Salsbery3-Sep-07 12:14
Mark Salsbery3-Sep-07 12:14 
Well, perhaps I was a bit harsh about the decency of the code.  If it works, I guess nothing's wrong
with it.  Smile | :)
653057337 wrote:
ould you suggest how would you handle, if the input_time would be "Thu Jan 1 00:00:00 1970"

I guess to fit the method shown, you'd have to check for "year-wrap" and subtract a year's worth
of seconds if necessary.


I personally prefer to work with the COleDateTime class and its companion, COleDateTimeSpan.

COleDateTime handles date/time from Jan 1, 100 to Dec 31, 9999.

With COleDateTime, to find the date/time for the nearest previous Sunday at midnight,
you could

1) find the day of the week for a given COleDateTime (COleDateTime::GetDayOfWeek())
2) Calculate how many days past Sunday it is (COleDateTime::GetDayOfWeek() - 1)
3) Create a COleDateTimeSpan representing the number of days from Sunday and the
  hours, mins, and seconds from midnight. (value from step 2 with COleDateTime::GetHour(),
  COleDateTime::GetMinute(), and COleDateTime::GetSecond())
4) Subtract the COleDateTimeSpan from the original COleDateTime (COleDateTime::operator -=)

Mark





Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Could you please help me to understand what ( str_time.substr(11,2) != "00" ) would do Pin
6530573372-Sep-07 4:19
6530573372-Sep-07 4:19 
Questionload GIF file in the turbo c++ Pin
mahdiehIR1-Sep-07 3:51
mahdiehIR1-Sep-07 3:51 
AnswerRe: load GIF file in the turbo c++ Pin
Mark Salsbery1-Sep-07 7:59
Mark Salsbery1-Sep-07 7:59 
QuestionWhy two vfptr incase of virtual inhertance? Pin
Sameer_Thakur31-Aug-07 19:38
Sameer_Thakur31-Aug-07 19:38 
AnswerRe: Why two vfptr incase of virtual inhertance? Pin
prasad_som1-Sep-07 3:59
prasad_som1-Sep-07 3:59 
QuestionAccess between classes Pin
BuckBrown31-Aug-07 10:47
BuckBrown31-Aug-07 10:47 
AnswerRe: Access between classes Pin
Gammill31-Aug-07 10:57
Gammill31-Aug-07 10:57 
QuestionHowTo: Create MFC CDialog from Win Forms Pin
Gammill31-Aug-07 9:39
Gammill31-Aug-07 9:39 
AnswerRe: HowTo: Create MFC CDialog from Win Forms Pin
Gammill31-Aug-07 10:49
Gammill31-Aug-07 10:49 
QuestionIdentification of batch file name/path Pin
Jack Rong30-Aug-07 4:54
Jack Rong30-Aug-07 4:54 
QuestionI Need to make the CListCtrl non sortable at run time Pin
Javed Akhtar Ansari30-Aug-07 0:49
Javed Akhtar Ansari30-Aug-07 0:49 
AnswerRe: I Need to make the CListCtrl non sortable at run time Pin
sps-itsec4630-Aug-07 1:31
sps-itsec4630-Aug-07 1:31 
QuestionWarnings in c++/cli that make me a lot of headache Pin
hansipet29-Aug-07 23:07
hansipet29-Aug-07 23:07 
AnswerRe: Warnings in c++/cli that make me a lot of headache Pin
George L. Jackson30-Aug-07 1:53
George L. Jackson30-Aug-07 1:53 
GeneralRe: Warnings in c++/cli that make me a lot of headache Pin
hansipet30-Aug-07 2:19
hansipet30-Aug-07 2:19 
GeneralRe: Warnings in c++/cli that make me a lot of headache Pin
George L. Jackson30-Aug-07 2:53
George L. Jackson30-Aug-07 2:53 
GeneralRe: Warnings in c++/cli that make me a lot of headache Pin
hansipet30-Aug-07 20:19
hansipet30-Aug-07 20:19 

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.