Timesquare date format
Moderators: adafruit_support_bill, adafruit

Timesquare date format

by guillermo3r on Tue Mar 12, 2013 3:39 am

Hi to everybody,
I would like to change the date display format from MM/DD/YY to DD/MM/YY
Can anybody tell me what changes should I make on the code to achive this?
Thanks
Guillermo.
guillermo3r
 
Posts: 17
Joined: Wed Sep 23, 2009 3:42 am

Re: Timesquare date format

by pburgess on Tue Mar 12, 2013 2:36 pm

Howdy!

Let's see...in examples/Watch/Marquee.pde, look for this block starting around line 207:
Code: Select all | TOGGLE FULL SIZE
    } else {
      loadDigits(now.year() - 2000, DIGIT_YEAR0);
      loadDigits(now.month()      , DIGIT_MON0);
      loadDigits(now.day()        , DIGIT_DAY0);
      if(digit[DIGIT_MON0] > 0) str[len++] = digit[DIGIT_MON0];
      str[len++] = digit[DIGIT_MON1];
      str[len++] = SYM_SLASH;
      if(digit[DIGIT_DAY0] > 0) str[len++] = digit[DIGIT_DAY0];
      str[len++] = digit[DIGIT_DAY1];
      str[len++] = SYM_SLASH;
      str[len++] = digit[DIGIT_YEAR0];
      str[len++] = digit[DIGIT_YEAR1];
    }

The code here is piecing together a date string which is later used for reference to 'blit' a set of bitmaps to the display. Just need to switch a few lines around to put the day first:
Code: Select all | TOGGLE FULL SIZE
    } else {
      loadDigits(now.year() - 2000, DIGIT_YEAR0);
      loadDigits(now.month()      , DIGIT_MON0);
      loadDigits(now.day()        , DIGIT_DAY0);
      if(digit[DIGIT_DAY0] > 0) str[len++] = digit[DIGIT_DAY0];
      str[len++] = digit[DIGIT_DAY1];
      str[len++] = SYM_SLASH;
      if(digit[DIGIT_MON0] > 0) str[len++] = digit[DIGIT_MON0];
      str[len++] = digit[DIGIT_MON1];
      str[len++] = SYM_SLASH;
      str[len++] = digit[DIGIT_YEAR0];
      str[len++] = digit[DIGIT_YEAR1];
    }
User avatar
pburgess
 
Posts: 2739
Joined: Sun Oct 26, 2008 2:29 am

Re: Timesquare date format

by guillermo3r on Tue Mar 12, 2013 3:45 pm

Thanks for your rapid response :D
guillermo3r
 
Posts: 17
Joined: Wed Sep 23, 2009 3:42 am