Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Holidays
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00233510
Message ID:
00233550
Views:
23
>Is anyone aware of existing code that will return the name of a holiday (if applicable) for any given date?
>
>ie. Holiday({^1999-12-25}) would return "Christmas"
>
>TIA
You might be able to alter this to do what you want. It does US federal holidays.
PROCEDURE whatday
PARAMETER test_date
LOCAL holiday_flag
holiday_flag = 'Not A Holiday.'

DO CASE
CASE( DAY( test_date ) = 1 AND MONTH( test_date ) = 1)
holiday_flag = 'New Years Day'. && January 1st
CASE( CDOW( test_date ) = 'Monday' ;
AND DAY( test_date ) > 14 ;
AND DAY( test_date ) < 22 ;
AND MONTH( test_date ) = 1 )
holiday_flag = ' Martin Luther King Birthday'
CASE( CDOW( test_date ) = 'Monday' ;
AND DAY( test_date ) > 14 ;
AND DAY( test_date ) < 22 ;
AND MONTH( test_date ) = 2 )
holiday_flag =" Washingtons Birthday"
CASE( CDOW( test_date ) = 'Monday' ;
AND DAY( test_date ) > 24 ;
AND MONTH( test_date ) = 5 )
holiday_flag = ' Memorial Day'
CASE( CDOW( test_date ) = 'Monday' ;
AND ( DAY( test_date ) = 5 OR DAY( test_date ) = 6 ) ;
AND MONTH( test_date ) = 7 ) ;
OR ( DAY( test_date ) = 4 AND MONTH( test_date ) = 7 )
holiday_flag = 'Independence Day'
CASE( CDOW( test_date ) = 'Monday' ;
AND DAY( test_date ) < 8 ;
AND MONTH( test_date ) = 9 )
holiday_flag ='Labor DAY'
CASE( CDOW( test_date ) = 'Monday' ;
AND DAY( test_date ) > 7 ;
AND DAY( test_date ) < 15 ;
AND MONTH( test_date ) = 10 )
holiday_flag = ' Columbus Day'
CASE( DAY( test_date ) = 11 AND MONTH( test_date ) = 11)
holiday_flag = ' Veterans Day'
CASE( CDOW( test_date ) = 'Thursday' ;
AND DAY( test_date ) > 21 ;
AND DAY(test_date) < 29 ;
AND MONTH(test_date) = 11)
holiday_flag = ' Thanksgiving'
CASE( DAY( test_date ) = 25 ) AND MONTH(test_date) = 12
test_dateholiday_flag = ' Christmas'
ENDCASE
?holiday_flag
Previous
Reply
Map
View

Click here to load this message in the networking platform