Search Unity

Calendar with Bank Holidays

Discussion in 'Scripting' started by gegebel, Feb 15, 2018.

  1. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Hello Folks,

    I'm using DateTime in my game and start the game in 1980.
    I have daily Tasks triggering at specific time of day, but I want to skip these tasks if the day in-game is a bank Holiday, like Christmas or Easter or New Years day.

    Of course I could check if DateTime.day == 1 && DateTime.month == 1 and so on but I thought of a List, array or something else going like

    if(DateTime != Holiday)

    I'm not aware of any function telling if a specific day is a holiday, so I'm open to any suggestion
     
  2. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    For which country?
    For which culture?

    .NET isn't wikipedia.
     
  3. gegebel

    gegebel

    Joined:
    Jan 29, 2014
    Posts:
    469
    Western Countries. The script can always be set to the wanted country or culture, so why does it matter in the end ?
     
  4. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    Because holiday plans in some countries change more often than .net standard. (but civilizations rise and fall in time Unity's mono changes .Net version :))
    Just draw holiday dates from some external source.
     
  5. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    There aren't that many "bank holidays" I would just hard code them if I were you.

    Well, Easter is fun -- you can look that one up ;) lol
    * Did that for a game w/ my friend... For a holiday theme.
     
  6. Fido789

    Fido789

    Joined:
    Feb 26, 2013
    Posts:
    343
    Well, something like this could probably help. But if I would be you, I would reconsider implementing such a feature, I think it isn't worth the effort.