Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8360213
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:23:24+00:00 2026-06-09T11:23:24+00:00

How to determine which day is the first in week in current locale in

  • 0

How to determine which day is the first in week in current locale in C.
In Russia monday is the first day, but my mac shows localized calendar with wrong first day.
So i wonder if i can determine which day is the first in current locale. Thanks.

anatoly@mb:/Users/anatoly$ cal
     Июля 2012
вс пн вт ср чт пт сб
 1  2  3  4  5  6  7
 8  9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:23:26+00:00Added an answer on June 9, 2026 at 11:23 am

    I was wrong in my first post, and ICU provides a C API.

    So, if dependency on that library is acceptable for you, you can get the first of the week portably using the following snippet:

    #include <stdio.h>
    
    /* for calendar functions */
    #include <unicode/ucal.h>
    /* for u_cleanup() */
    #include <unicode/uclean.h>
    /* for uloc_getDefault() */
    #include <unicode/uloc.h>
    
    int main()
    {
        /* it *has* to be pre-set */
        UErrorCode err = U_ZERO_ERROR;
    
        UCalendar* cal = ucal_open(
                0, -1, /* default timezone */
                uloc_getDefault(), /* default (current) locale */
                UCAL_DEFAULT, /* default calendar type */
                &err);
    
        if (!cal)
        {
            fprintf(stderr, "ICU error: %s\n", u_errorName(err));
            u_cleanup();
            return 1;
        }
    
        /* 1 for sunday, 2 for monday, etc. */
        printf("%d\n", ucal_getAttribute(cal, UCAL_FIRST_DAY_OF_WEEK));
    
        ucal_close(cal);
        u_cleanup();
        return 0;
    }
    

    Then you link the program with icu-i18n pkg-config library.

    Ah, and they have quite an extensive example printing a calendar, if you might be interested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to determine the current day of the week in my app. To
Possible Duplicate: Determine what day of week the week starts with How to determine
I want to determine day, month, and year of current date in iOS. I
Problem: Determine which radio button was sent based on their order and submit the
I want to determine which part of audio file contain speech or music. I
How do we determine which user the php script is running under when I
How to determine which version of OpenCV I have installed? I am most interested
I am trying to determine which implementation of the data structure would be best
How can you determine which rubygem is being used in response to a require
How does Castle Windsor determine which constructor to resolve when there are multiple constructors

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.