根据最新的Andr​​oid中找了一天 [英] Find a day according to date in android

查看:116
本文介绍了根据最新的Andr​​oid中找了一天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个问题:


  1. 我如何才能找到什么根据JAVA某一特定日期星期几?

  1. How can I find what is the day of the week according to a specific date in JAVA ?

我想找到(每次包括日期和时间),Java或PHP 2倍之间的差异,有人能帮助我吗?

I want to find a difference between 2 times (each time include date and hour) in Java or PHP, someone can help me with that?

感谢名单,

编辑:
我仍然有一个问题,我不成功找到一个特定日期的日期...我想要2种方式,boths不工作。

I still have a problem with that, I dont success to find the date of a specific date... i'm trying 2 ways, boths are not working.

1

GregorianCalendar g = new GregorianCalendar(year, month, day, hour, min);
 int dayOfWeek=g.DAY_OF_WEEK;

2

Calendar cal = Calendar.getInstance();
cal.set(year, month, day, hour, min);           
int dayOfWeek2 = cal.get(Calendar.DAY_OF_WEEK);

甘蔗有人给我一个解决方案吗?

Someone cane give me another solution?

推荐答案

请参阅这些链接,

找到星期

根据一个特定的日期,以找到一周中的天

to find the day of the week according to a specific date

尝试像下面,

Calendar calendar=Calendar.getInstance();

calendar.setTime(specific_date);

int weekday = calendar.get(Calendar.DAY_OF_WEEK);

查找

这篇关于根据最新的Andr​​oid中找了一天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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