Display Month in Spanish using strftime?

Display Month in Spanish using strftime?



I am trying to get the format a date from 2018-09-01 to September 1, 2018.
I have been using:


strftime(displayDate, sizeof(displayDate), "%B %d %Y", &date_obj);



It works perfectly, but, is there a way to format the Month to be in Spanish?





You must set the locale for Spanish first and then format the date string. See setlocale function.
– Andrew Truckle
Aug 29 at 15:05






Thank you. Will give it a try. If the locale is changed multiple times, can that cause issues with the OS?
– Jaime T
Aug 29 at 15:10




1 Answer
1



The strftime function formats dates based on the current locale. So you'll need to set the locale for LC_TIME first:


strftime


LC_TIME


setlocale(LC_TIME, "es_ES-UTF_8");



See setlocale for more information.


setlocale





Thank you. Will give it a try. If the locale is changed multiple times, can that cause issues with the OS?
– Jaime T
Aug 29 at 15:10





@JaimeT Setting the locale with setlocale only affects the current process, and only the given locale category.
– dbush
Aug 29 at 15:12


setlocale



Required, but never shown



Required, but never shown






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ