Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCD2004: Fixing date line to show the year #153

Open
h1aji opened this issue Sep 9, 2024 · 0 comments
Open

LCD2004: Fixing date line to show the year #153

h1aji opened this issue Sep 9, 2024 · 0 comments

Comments

@h1aji
Copy link

h1aji commented Sep 9, 2024

Hi Ed, can you edit following code as given to make date line showing year

}
sprintf ( datetxt, "%s %02d.%02d. %s", // Format new time to a string
WDAYS[timeinfo.tm_wday],
timeinfo.tm_mday,
timeinfo.tm_mon + 1,
str ) ;
}

Here I am cutting seconds to make more space for last two digists of the year

    strncpy(timetxt, str, 5);                            // Copy first 5 characters (HH:MM)
    timetxt[5] = '\0';                                   // Null-terminate the string
    sprintf ( datetxt, "%s  %02d.%02d.%02d  %s",         // Format new time to a string
                       WDAYS[timeinfo.tm_wday],
                       timeinfo.tm_mday,
                       timeinfo.tm_mon + 1,
                       (timeinfo.tm_year + 1900) % 100,  // last 2 digits of the year
                       timetxt ) ;

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant