|
-
October 1st, 2002, 10:16 AM
#1
how do I get "9/30/2002 12:00:01 PM"
How do I get today's date to be: "9/30/2002 12:00:01 PM"?
// added 09.30.2002
CString sDateTimeToday;
sDateTimeToday = Today.Format(_T("%A, %B %d, %Y"));
sDateTimeToday = Today.Format(VAR_DATEVALUEONLY);
COleDateTime sDateTimeTodayCOle = COleDateTime::GetCurrentTime();
CString s = sDateTimeTodayCOle.Format(_T("%Y-%M-%D 00:00:00.000"));
Wango
-
October 1st, 2002, 10:48 AM
#2
Try this
CString strToday;
COleDateTime today = COleDateTime::GetCurrentTime();
if (today.GetHour() > 12)
{
strToday.Format("%d/%02d/%4d %02d:%02d:%02d PM",
today.GetMonth(),
today.GetDay(),
today.GetYear(),
today.GetHour() - 12,
today.GetMinute(),
today.GetSecond());
}
else
{
strToday.Format("%d/%2d/%4d %2d:%2d:%2d AM",
today.GetMonth(),
today.GetDay(),
today.GetYear(),
today.GetHour(),
today.GetMinute(),
today.GetSecond());
}
Regards
Rolf
-
October 1st, 2002, 10:50 AM
#3
Oups sorry, some copy/paste problem, lol
in the else you should also have the same format string as below
strToday.Format("%d/%02d/%4d %02d:%02d:%02d PM",
-
October 1st, 2002, 10:53 AM
#4
Except with AM and not PM (poor tired Rolf )
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|