Joerg Nowak
April 6th, 1999, 07:46 PM
Is there a way to tell if daylight savings time is active. I need to check for daylight savings time and my program needs to perform two different functions depending whether the time zone is currently in DST or not
Thanks
Holger Persch
April 7th, 1999, 01:02 AM
Hi,
to check if daylight saving is in effect you do this:
for the current time
====================
setlocale( LC_ALL, "" ); // don't forget to set the locale
if( CTime::GetCurrentTime( ).GetLocalTm( )->tm_isdst == 0 )
{
TRACE0( "daylight saving is not in effect\n" );
}
else
{
TRACE0( "daylight saving is in effect\n" );
}
for any time
============
setlocale( LC_ALL, "" ); // don't forget to set the locale
if( CTime( 1999, 4, 7, 8, 53, 0, -1 ).GetLocalTm( )->tm_isdst == 0 )
{
TRACE0( "daylight saving is not in effect\n" );
}
else
{
TRACE0( "daylight saving is in effect\n" );
}
HTH
Holger