/**
-
判断两个时间是否属于同一天
-
@param time1
-
@param time2
-
@return
*/
public boolean isSameDay(long time1, long time2) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time1);
int day1 = calen.get(Calendar.DAY_OF_YEAR);
calen.setTimeInMillis(time2);
int day2 = calen.get(Calendar.DAY_OF_YEAR);
return day1 == day2;
}
/**
-
通过已知参数返回当前时间的年份
-
@param time
-
@return
*/
public int getYear(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
return calen.get(Calendar.YEAR);
}
/**
-
通过已知参数返回当前时间的分月(我能识别的1,2,3…)
-
@param time
-
@return
*/
public int getMonth(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
return calen.get(Calendar.MONTH) + 1;
}
/**
-
通过已知参数返回当前时间的日期(月份的)
-
@param time
-
@return
*/
public int getDayOfMonth(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
return calen.get(Calendar.DAY_OF_MONTH);
}
/**
-
通过已知参数返回当前时间的日期(年份的)
-
@param time
-
@return
*/
public int getDayOfYear(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
return calen.get(Calendar.DAY_OF_YEAR);
}
/**
-
通过给定的时间,返回我想要的日期形式
-
@param time
-
@return
*/
public String getMyDate(long time) {
return getMonth(time) + “月/” + getDayOfMonth(time);
}
/**
-
通过给定的时间,返回我想要的日期形式
-
@param time
-
@return
*/
public String getMyDateOne(long time) {
return getMonth(time) + “-” + getDayOfMonth(time);
}
/**
-
通过给定时间,返回小时和分钟的时间形式
-
@param time
-
@return
*/
public String getHourMinute(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
String hour = calen.get(Calendar.HOUR_OF_DAY) + “”;
String minute = calen.get(Calendar.MINUTE) + “”;
if (minute.length() == 1) {
minute = “0” + minute;
}
return hour + “:” + minute;
}
/**
-
@param time
-
@return
-
@描述:得到小时的时间形式
*/
public String getHour(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
String hour = calen.get(Calendar.HOUR_OF_DAY) + “”;
return hour;
}
/**
-
@param time
-
@return
-
@描述:得到分钟的时间形式
*/
public String getMinute(long time) {
Calendar calen = Calendar.getInstance();
calen.setTimeInMillis(time);
String minute = calen.get(Calendar.MINUTE) + “”;
return minute;
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的月和日07-13
*/
public String getDateTime(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“MM-dd”);
return sdf.format(new Date(time));
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的月和日2015-07-13
*/
public String getYearOrMonthOrDay(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“MM-dd”);
return sdf.format(new Date(time));
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的分和秒10:30
*/
public String getMinuteOrSeconds(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“hh:mm”);
return sdf.format(new Date(time));
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的月和日
*/
public String getDayOrMonthOrYear(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy-MM-dd”);
return sdf.format(new Date(time));
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的月和日
*/
public String getDayOrMonthOrYear2(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“MM月dd日”);
return sdf.format(new Date(time));
}
public String getDayOrMonthOrYear1(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“MM-dd HH:mm”);
return sdf.format(new Date(time));
}
/**
-
@param time
-
@return
-
@描述:得到固定格式的月和日27/01/16
*/
public String getCollectionDate(long time) {
SimpleDateFormat sdf = new SimpleDateFormat(“dd/MM/yy”);
return sdf.format(new Date(time));
}
public String dateFormat2(Date date){
return new SimpleDateFormat(“yyyy年-MM月-dd日 HH:mm:ss”, Locale.getDefault()).format(date);
}
/**
-
计算long类型的时间是一天的下午还是上午
-
HH是24小时制的时间
-
hh是12小时制的时间
-
@param time
-
@return
*/
public String getTimeDifference(long time){
SimpleDateFormat sdf = new SimpleDateFormat(“HH”);
int hour = Integer.parseInt(sdf.format(new Date(time)));
System.out.println("hour = "+hour);
if (hour<=12){
return “AM”;
}else{
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!
如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)
![](https://i-blog.csdnimg.cn/blog_migrate/f985fb7abc467495abf50b683c33ec65.jpeg)
最后
我见过很多技术leader在面试的时候,遇到处于迷茫期的大龄程序员,比面试官年龄都大。这些人有一些共同特征:可能工作了7、8年,还是每天重复给业务部门写代码,工作内容的重复性比较高,没有什么技术含量的工作。问到这些人的职业规划时,他们也没有太多想法。
其实30岁到40岁是一个人职业发展的黄金阶段,一定要在业务范围内的扩张,技术广度和深度提升上有自己的计划,才有助于在职业发展上有持续的发展路径,而不至于停滞不前。
不断奔跑,你就知道学习的意义所在!
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!
:Android)**
![](https://i-blog.csdnimg.cn/blog_migrate/f985fb7abc467495abf50b683c33ec65.jpeg)
最后
我见过很多技术leader在面试的时候,遇到处于迷茫期的大龄程序员,比面试官年龄都大。这些人有一些共同特征:可能工作了7、8年,还是每天重复给业务部门写代码,工作内容的重复性比较高,没有什么技术含量的工作。问到这些人的职业规划时,他们也没有太多想法。
其实30岁到40岁是一个人职业发展的黄金阶段,一定要在业务范围内的扩张,技术广度和深度提升上有自己的计划,才有助于在职业发展上有持续的发展路径,而不至于停滞不前。
不断奔跑,你就知道学习的意义所在!
《互联网大厂面试真题解析、进阶开发核心学习笔记、全套讲解视频、实战项目源码讲义》点击传送门即可获取!