Android的:如何获得一周中的当前日(星期一,等...),在用户的语言? [英] Android: how to get the current day of the week (Monday, etc...) in the user's language?

查看:713
本文介绍了Android的:如何获得一周中的当前日(星期一,等...),在用户的语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是一周中的当前天(星期一,星期二...)在用户的本地语言。例如,Lundi狂欢等...如果用户是法国。

I want to know what the current day of the week is (Monday, Tuesday...) in the user's local language. For example, "Lundi" "Mardi" etc... if the user is French.

我看过这篇文章,它,但它只是返回一个int,而不是字符串的一天,在用户的语言:<一href="http://stackoverflow.com/questions/5574673/what-is-the-easiest-way-to-get-the-current-day-of-the-week-in-android">What是让周当天在Android上最简单的方法是什么?

I have read this post, it but it only returns an int, not a string with the day in the user's language: What is the easiest way to get the current day of the week in Android?

更一般地,你怎么弄的一周中的每一天,并写在用户的语言在今年所有月份?

More generally, how do you get all the days of the week and all the months of the year written in the user's language ?

我认为这是可能的,例如谷歌日程给出了日,月写在用户的本地语言。

I think that this is possible, as for example the Google agenda gives the days and months written in the user's local language.

谢谢!

推荐答案

使用的SimpleDateFormat 以日期和时间格式为人类可读的字符串,相对于用户的语言环境。

Use SimpleDateFormat to format dates and times into a human-readable string, with respect to the users locale.

小例子来获得一周的(例如,星期一)的当前日的:

Small example to get the current day of the week (e.g. "Monday"):

SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
Date d = new Date();
String dayOfTheWeek = sdf.format(d);

这篇关于Android的:如何获得一周中的当前日(星期一,等...),在用户的语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆