Click to See Complete Forum and Search --> : Finding out the system date
Zulfi Khan
May 11th, 1999, 06:53 AM
I am using _strdate function to find out the system date but its not Y2k compliant, means that its giving date in the form 03/04/99. I want the date in the form 03/04/1999. How I can solve this problem?
Zulfi.
Lothar Haensler
May 11th, 1999, 06:59 AM
the GetSystemTime api fills a SYSTEMTIME structure that contains a 4 digit wYear member.
Zulfi Khan
May 13th, 1999, 04:19 AM
Thanks for your suggestion but its giving me some problem
I am doing the following things:
LPSYSTEMTIME lpSystemTime;
GetSystemTime(lpSystemTime);
int k= lpSystemTime->wYear;
when I check the value through debugger k = 19595
which is wrong k should be 1999.
I tried making k UINT but this also didnt work. Actually the value
in lpSystemTime->wYear is itself 19595.
Rail Jon Rogut
May 13th, 1999, 06:14 AM
How about:
#include < afx.h >
CTime tTime = CTime::GetCurrentTime();
CString szTemp = tTime.Format( "%m/%d/%Y - %H:%M:%S" );
The string szTemp will equal something like:
05/13/1999 - 03:55:19
(Note the capital Y as in %Y to give the complete year with the century)
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
railro@earthlink.net
http://home.earthlink.net/~railro/
Zulfi Khan
May 14th, 1999, 01:57 AM
Thanks, its running fine no problem now.
Zulfi.
ksheeraj
May 14th, 1999, 02:05 AM
Try this
SYSTEMTIME st;
GetSystemTime(&st);
printf("Year : %d",st.wYear);
Ksheeraj
39639,Leslie St.
Apt #157
Fremont USA 94538
sally
May 14th, 1999, 02:37 AM
Can I add one another related query here?
Assume that one user has his/hers Windows Date setting to YYMMDD and another user has his/hers Windows Date setting to DDMMYY, and I want to make sure that
a) The chosen format is in principle retained, ie, not force Japanses/Swedish users to go to the continnental format and vice versa
b) To show the year using 4 digits
How can I get the current Windows Date settings in a format like %y%m%d or %d%m%y and then programmatically replace
%y with %Y.
This is giving us some headache, as we need to internationalis our app and also make sure dates are displayed retaining regional settings and being Y2K compliant.... (or at least visually compliant)
Thanks for your help.....
Sally
Sally
May 14th, 1999, 02:37 AM
Can I add one another related query here?
Assume that one user has his/hers Windows Date setting to YYMMDD and another user has his/hers Windows Date setting to DDMMYY, and I want to make sure that
a) The chosen format is in principle retained, ie, not force Japanses/Swedish users to go to the continnental format and vice versa
b) To show the year using 4 digits
How can I get the current Windows Date settings in a format like %y%m%d or %d%m%y and then programmatically replace
%y with %Y.
This is giving us some headache, as we need to internationalis our app and also make sure dates are displayed retaining regional settings and being Y2K compliant.... (or at least visually compliant)
Thanks for your help.....
Sally
anand123
January 23rd, 2005, 11:04 PM
I too got the same problem .
My application is not running Sweden,denmark until the regional settings are changed to that of UK.
Can anyone help to run the code with default settings or programmatically set the regional settings
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.