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
Printable View
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
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