displaying the day of the week from system clock

part12studiospart12studios Member Posts: 620
edited February 2012 in Working with GS (Mac)
I was wondering if there is a way to accurately display the correct day using the system clock of an iOS or android device? I know you can see the clock and time... but it seems like it would lack the day of the week name.

It seems like maybe if the clock date is really just a big number that could be divided by 7, the current day might be derived.. but then i don't know if leap years change this...

Any advice would be welcome! :)

Thanks!
Caleb

Comments

  • Asobu_GamesAsobu_Games PRO Posts: 261
    Bump. I was wondering the same thing.
  • part12studiospart12studios Member Posts: 620
    I think the general sentiment is that while it's probably possible it's a pain in the ass.. basically what we need to know is what is the first actual day of the clock.. i would imagine that the clock is little more than a big number that gets sub divided in to various values.. i don't know that for a fact.. thats just my guess.. but if we know what was the first day of the clock.. like 1956.. or 1977.. then we could divide that down.. the biggest wrench i see in it is those damn leap years.. like the one we just had.. i guess its every 4 years so at least it's consistent.. but yea until i know what the first date DAY is.. i'm not sure how that data could be extracted.. fortunately days are not effected by months.. except the leap year of course
  • Asobu_GamesAsobu_Games PRO Posts: 261
    Yeah I agree. I can think of some ways but all a big pain. One way I thought of would be to program in every single day for the foreseeable future (by checking a calendar), but this is too annoying obviously unless it was absolutely crucial to have the days of the week in your app. ie if year = 2012, month = 3, day = 8. then weekday = thursday. :P

    Way too annoying for what I am after, so I won't bother unless there is a more simple way.
  • simo103simo103 Member, PRO Posts: 1,331
    Found a formula on the web that did the magic ... if it's of use to you, here's the demo project:

    http://www.funkymunkygames.com/Promo/dayofweek2.gameproj.zip
  • Rob2Rob2 Member Posts: 2,402
    edited March 2012
    @simo103 Had been looking at this on and off all day. When I came to post not only had it already been sorted but your project had exactly the same name !! :) Anyway looks like we went about it quite differently and I added in the superscript (3rd 4th etc handling) as a bit of extra table fun. http://bit.ly/wkoPEk
  • simo103simo103 Member, PRO Posts: 1,331
    @Rob2 ... lol ... thought this problem might attract one or two attempts :D ... nice polish with the superscripts etc. May have lost the original poster but worth keeping in a folder somewhere .. never know when someones game just needs this ... looking forward to the next challenge!
  • MotherHooseMotherHoose Member Posts: 2,456
    loved both of them! … liked the superscript

    started doing my own using the formulas in Wikipedia
    but, for my purposes … only need this years and next years
    so made a cvs file in TextEdit and copied/pasted the week of days (once you have Jan in just enter and paste) …
    less hassle for me and less resources as the tables are only referenced and not loaded in RAM … aha, that was before I saw yours!

    got both of them … @Rob2 and @simo103 … in a safe place! … >:D<

    @};- MH
  • part12studiospart12studios Member Posts: 620
    wow that is awesome! that example was exactly what i needed. thanks! Where did you find these formulas? I tried wikipedia also but had no luck. You all rock! thanks for finding such awesome solutions! :)
  • MotherHooseMotherHoose Member Posts: 2,456
    http://en.wikipedia.org/wiki/Determination_of_the_day_of_the_week

    aren't @Rob2 and @simo103 just so good to do all the work for us! Thanx!

    @};- MH
  • Rob2Rob2 Member Posts: 2,402
    Yeah it was sort of fun to do - :)
Sign In or Register to comment.