views:

32

answers:

2

In some countries weekend days are Friday/Saturday.

How can a Windows application find out weekend days of the user?

+1  A: 

Wellll...I don't know of a "One function" answer to this. You're gonna need to know where they are somehow. If it's a webapp, you can trace their IP and figure out what country they are from. If it's a windows app, you're probably going to need to ask them (The clock only provides timezone information, and i can't figure out where else to grab a more fine-grained location from windows).

You can figure out what day it is with GetDayofWeek http://msdn.microsoft.com/en-us/library/1wzak8d0%28VS.80%29.aspx in MFC

DayofWeek if you hop to .Net http://msdn.microsoft.com/en-us/library/system.dayofweek.aspx

You'll need a lookup table with countries/what days they consider weekends..you'll probably have to construct this, but you can get a list of countries from: http://www.iso.org/iso/english_country_names_and_code_elements

That list is ISO 3166.

It's updated and should be your "one-stop-shop" for the listing. From there, you'll match "weekends" to the countries. http://en.wikipedia.org/wiki/Workweek might help in figuring out weekends/workweeks for countries.

Caladain
Nice quotes in profile, btw.
Constantin
Thanks! Did that solve your issue/explain things a bit?
Caladain
@Caladain, yeah, it was helpful. I am just giving other people a chance before accepting it.
Constantin
A: 

ICU project might help. It is designed for software internalization and globalization. C/C++ and Java version are available.

icu-project.org

lcmtwn