tags:

views:

48

answers:

2

In VC++ 6.0 MFC application i am trying to Display date in Shot Format eg;05-10-09 but it will print 05-10-2009

Here is the code i written SYSTEMTIME st; GetSystemTime(&st);

CString str;

str.Format("%02d-%02d-%02d",st.wDay,st.wMonth,st.wYear); m_date=m_date + str;

I will get output say eg: 05-10-2009, but i want in this format 05-10-09

Plz any body help me

A: 
  1. it should be %02d-%02d-%02d, and not %02d-%02d-02%d
  2. The proper way should be using CTime::Format (I Don't know if VC 6 had that)
  3. pass (st.Year % 100)
Shay Erlichmen
humm, sorry while asking question i did mistake it is %02d-%02d-%02d then also i will get output eg: 02-11-2009 , i want to display it 02-11-09 how i can do it any hint,
+1  A: 

... "%02d", st.wYear % 100 ...

plan9assembler