Link to home
Start Free TrialLog in
Avatar of habibb
habibbFlag for Pakistan

asked on

Proper date and time formate

Hope every expert will be fine.
i want to get current date and time in the formate like this   04/15/2002 05:25:45 PM or 04/15/2002 05:25:45
tell me simple way because I am new in VC++.
waiting for Good from all experts.
Thanks
ASKER CERTIFIED SOLUTION
Avatar of pagladasu
pagladasu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zzynx
Just a comment,

Are you sure you want it to be formatted that way?
Doesn't the user of your program expect the format to correspond with his regional settings?

If yes, then just use the most simple form of Format():

COleDateTime odt = COleDateTime::GetCurrentTime();
CString strNow = odt.Format();

Bye.