如何在Android中使用特定日期获取当前日期名称? [英] How the get the current day name using particular date in android?

查看:150
本文介绍了如何在Android中使用特定日期获取当前日期名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有日期字符串18-2-2012,据此如何获取当前日期名称,即今天是"星期六".明天的日期为19-2-2012,日期名称为"星期日".

I have date string 18-2-2012 , from this how to get the current day name i.e., today is "saturday" like this. for tomorrow's date 19-2-2012 and the day name is "sunday".

推荐答案

使用Java日期格式.

Use java date formats.

SimpleDateFormat inFormat = new SimpleDateFormat("dd-MM-yyyy");
Date date = inFormat.parse(input);
SimpleDateFormat outFormat = new SimpleDateFormat("EEEE");
String goal = outFormat.format(date); 

这篇关于如何在Android中使用特定日期获取当前日期名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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