Timesquare date format

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
guillermo3r
 
Posts: 17
Joined: Wed Sep 23, 2009 3:42 am

Timesquare date format

Post by guillermo3r »

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.

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: Timesquare date format

Post by pburgess »

Howdy!

Let's see...in examples/Watch/Marquee.pde, look for this block starting around line 207:

Code: Select all

    } 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

    } 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
guillermo3r
 
Posts: 17
Joined: Wed Sep 23, 2009 3:42 am

Re: Timesquare date format

Post by guillermo3r »

Thanks for your rapid response :D

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”