return getDateString(new Date(), dateFormat);
}
public static String getTomorrowString() {
DateFormat dateFormat = getNewDateFormat(SHORT_FORMAT);
return getDateString(DateUtil.addDays(new Date(), 1), dateFormat);
}
public static String getTimeString(Date date) {
DateFormat dateFormat = getNewDateFormat(timeFormat);
return getDateString(date, dateFormat);
}
public static String getBeforeDayString(int days) {
Date date = new Date(System.currentTimeMillis() - ONE_DAY_MILL_SECONDS * days);
DateFormat dateFormat = getNewDateFormat(SHORT_FORMAT);
return getDateString(date, dateFormat);
}
/**
-
取得两个日期间隔毫秒数(日期1-日期2)
-
@param one 日期1
-
@param two 日期2
-
@return 间隔秒数
*/
public static long getDiffMillis(Date one, Date two) {
Calendar sysDate = new GregorianCalendar();
sysDate.setTime(one);
Calendar failDate = new GregorianCalendar();
failDate.setTime(two);
return sysDate.getTimeInMillis() - failDate.getTimeInMillis();
}
/**
-
取得两个日期间隔秒数(日期1-日期2)
-
@param one 日期1
-
@param two 日期2
-
@return 间隔秒数
*/
public static long getDiffSeconds(Date one, Date two) {
Calendar sysDate = new GregorianCalendar();
sysDate.setTime(one);
Calendar failDate = new GregorianCalendar();
failDate.setTime(two);
return (sysDate.getTimeInMillis() - failDate.getTimeInMillis()) / 1000;
}
/**
-
取得两个日期间隔分钟数(日期1-日期2)
-
@param one 日期1
-
@param two 日期2
-
@return 间隔秒数
*/
public static long getDiffMinutes(Date one, Date two) {
Calendar sysDate = new GregorianCalendar();
sysDate.setTime(one);
Calendar failDate = new GregorianCalendar();
failDate.setTime(two);
return (sysDate.getTimeInMillis() - failDate.getTimeInMillis()) / (60 * 1000);
}
/**
-
取得两个日期的间隔天数
-
@param one
-
@param two
-
@return 间隔天数
*/
public static long getDiffDays(Date one, Date two) {
Calendar sysDate = new GregorianCalendar();
sysDate.setTime(one);
Calendar failDate = new GregorianCalendar();
failDate.setTime(two);
return (sysDate.getTimeInMillis() - failDate.getTimeInMillis()) / (24 * 60 * 60 * 1000);
}
/**
-
取得两个日期相差的自然日
-
@param date1
-
@param date2
-
@return
*/
public static long getDiffNaturalDays(Date date1, Date date2) throws ParseException {
return Math.abs(getDiffNaturalDayNotAbs(date1, date2));
}
/**
-
取得两个日期相差的自然日
-
@param date1
-
@param date2
-
@return
*/
public static long getDiffNaturalDayNotAbs(Date date1, Date date2) throws ParseException {
long diffDays;
DateFormat dateFormat = new SimpleDateFormat(webFormat);
//去掉时分秒
String dateStr1 = dateFormat.format(date1);
String dateStr2 = dateFormat.format(date2);
diffDays = (dateFormat.parse(dateStr1).getTime() - dateFormat.parse(dateStr2).getTime()) / (24 * 60 * 60 * 1000);
return diffDays;
}
public static String getBeforeDayString(String dateString, int days) throws ParseException {
DateFormat df = getNewDateFormat(SHORT_FORMAT);
Date date = df.parse(dateString);
date = new Date(date.getTime() - ONE_DAY_MILL_SECONDS * days);
return df.format(date);
}
public static boolean isValidShortDateFormat(String strDate) {
if (strDate == null || strDate.length() != SHORT_FORMAT.length()) {
return false;
}
try {
// ---- 避免日期中输入非数字 ----
Integer.parseInt(strDate);
} catch (NumberFormatException e) {
return false;
}
DateFormat df = getNewDateFormat(SHORT_FORMAT);
try {
df.parse(strDate);
} catch (ParseException e) {
return false;
}
return true;
}
public static boolean isValidShortDateFormat(String strDate, String delimiter) {
String temp = strDate.replaceAll(delimiter, “”);
return isValidShortDateFormat(temp);
}
/**
-
判断表示时间的字符是否为符合yyyyMMddHHmmss格式
-
@param strDate
-
@return
*/
public static boolean isValidLongDateFormat(String strDate) {
if (strDate.length() != LONG_FORMAT.length()) {
return false;
}
try {
Long.parseLong(strDate); // ---- 避免日期中输入非数字 ----
} catch (Exception NumberFormatException) {
return false;
}
DateFormat df = getNewDateFormat(LONG_FORMAT);
try {
df.parse(strDate);
} catch (ParseException e) {
return false;
}
return true;
}
/**
-
判断表示时间的字符是否为符合yyyyMMddHHmmss格式
-
@param strDate
-
@param delimiter
-
@return
*/
public static boolean isValidLongDateFormat(String strDate, String delimiter) {
String temp = strDate.replaceAll(delimiter, “”);
return isValidLongDateFormat(temp);
}
public static String getShortDateString(String strDate) {
return getShortDateString(strDate, “-|/”);
}
public static String getShortDateString(String strDate, String delimiter) {
if (StringUtils.isBlank(strDate)) {
return null;
}
String temp = strDate.replaceAll(delimiter, “”);
if (isValidShortDateFormat(temp)) {
return temp;
}
return null;
}
public static String getShortFirstDayOfMonth() {
Calendar cal = Calendar.getInstance();
Date dt = new Date();
cal.setTime(dt);
cal.set(Calendar.DAY_OF_MONTH, 1);
DateFormat df = getNewDateFormat(SHORT_FORMAT);
return df.format(cal.getTime());
}
public static String getWebTodayString() {
DateFormat df = getNewDateFormat(webFormat);
return df.format(new Date());
}
/**
-
获取当月首日
-
@return
*/
public static String getWebFirstDayOfMonth() {
Calendar cal = Calendar.getInstance();
Date dt = new Date();
cal.setTime(dt);
cal.set(Calendar.DAY_OF_MONTH, 1);
DateFormat df = getNewDateFormat(webFormat);
return df.format(cal.getTime());
}
/**
-
获取当月的总天数
-
@return
*/
public static int getDaysOfMonth() {
Calendar cal = Calendar.getInstance(Locale.CHINA);
return cal.getActualMaximum(Calendar.DATE);
}
public static String convert(String dateString, DateFormat formatIn, DateFormat formatOut) {
try {
Date date = formatIn.parse(dateString);
return formatOut.format(date);
} catch (ParseException e) {
return “”;
}
}
public static String convert2WebFormat(String dateString) {
DateFormat df1 = getNewDateFormat(SHORT_FORMAT);
DateFormat df2 = getNewDateFormat(webFormat);
return convert(dateString, df1, df2);
}
public static String convert2ChineseDtFormat(String dateString) {
DateFormat df1 = getNewDateFormat(SHORT_FORMAT);
DateFormat df2 = getNewDateFormat(chineseDtFormat);
return convert(dateString, df1, df2);
}
public static String convertFromWebFormat(String dateString) {
DateFormat df1 = getNewDateFormat(SHORT_FORMAT);
DateFormat df2 = getNewDateFormat(webFormat);
return convert(dateString, df2, df1);
}
public static boolean webDateNotLessThan(String date1, String date2) {
DateFormat df = getNewDateFormat(webFormat);
return dateNotLessThan(date1, date2, df);
}
/**
-
@param date1
-
@param date2
-
@param format
-
@return
*/
public static boolean dateNotLessThan(String date1, String date2, DateFormat format) {
try {
Date d1 = format.parse(date1);
Date d2 = format.parse(date2);
return !d1.before(d2);
} catch (ParseException e) {
return false;
}
}
public static String getEmailDate(Date today) {
String todayStr;
SimpleDateFormat sdf = new SimpleDateFormat(“yyyy年MM月dd日HH:mm:ss”);
todayStr = sdf.format(today);
return todayStr;
}
public static String getSmsDate(Date today) {
String todayStr;
SimpleDateFormat sdf = new SimpleDateFormat(“MM月dd日HH:mm”);
todayStr = sdf.format(today);
return todayStr;
}
public static String formatMonth(Date date) {
if (date == null) {
return null;
}
return new SimpleDateFormat(monthFormat).format(date);
}
/**
-
获取系统日期的前一天日期,返回Date
-
@return
*/
public static Date getBeforeDate() {
Date date = new Date();
return new Date(date.getTime() - ONE_DAY_MILL_SECONDS);
}
/**
-
获得指定时间当天起点时间
-
@param date
-
@return
*/
public static Date getDayBegin(Date date) {
DateFormat df = new SimpleDateFormat(“yyyyMMdd”);
df.setLenient(false);
String dateString = df.format(date);
try {
return df.parse(dateString);
} catch (ParseException e) {
return date;
}
}
/**
-
根据Date对象返回今天是星期几
-
@param date
-
@return 1:星期日 2:星期一 3:星期二 4:星期三 5:星期四 6:星期五 7:星期六
*/
public static int getWeekDayFromDateEntity(Date date) {
Calendar calendar = Calendar.getInstance();// 获得一个日历
calendar.setTime(date);
return calendar.get(Calendar.DAY_OF_WEEK);
}
/**
-
判断参date上min分钟后,是否小于当前时间
-
@param date
-
@param min
-
@return
*/
public static boolean dateLessThanNowAddMin(Date date, long min) {
return addMinutes(date, min).before(new Date());
}
public static boolean isBeforeNow(Date date) {
if (date == null) {
return false;
}
return date.compareTo(new Date()) < 0;
}
/**
-
获得当前月的开始日期
-
@param date
-
@return
*/
public static Date getMinMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat fmt = new SimpleDateFormat(webFormat);
calendar.setTime(fmt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMinimum(Calendar.DAY_OF_MONTH));
return calendar.getTime();
}
/**
-
获得当前月的结束日期
-
@param date
-
@return
*/
public static Date getMaxMonthDate(String date) throws ParseException {
Calendar calendar = Calendar.getInstance();
SimpleDateFormat fmt = new SimpleDateFormat(webFormat);
calendar.setTime(fmt.parse(date));
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
return calendar.getTime();
}
public static Date parseNoSecondFormat(String sDate) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(noSecondFormat);
return dateFormat.parse(sDate);
}
/*
-
date日期转变成 制定格式字符串
*/
public static String convertDate2String(Date date, String time_pattern) {
SimpleDateFormat sf = new SimpleDateFormat(time_pattern);
return sf.format(date);
}
/**
-
根据Date对象返回天
-
@param date
*/
public static int getDayFromDateEntity(Date date) {
Calendar calendar = Calendar.getInstance();// 获得一个日历
calendar.setTime(date);
return calendar.get(Calendar.DATE);
}
public static int compareDateStr(String dateStr, String anotherDateStr) throws ParseException {
DateFormat df = new SimpleDateFormat(webMonthFormat);
Date dt1 = df.parse(dateStr);
Date dt2 = df.parse(anotherDateStr);
return Long.compare(dt1.getTime(), dt2.getTime());
}
public static String getCurMonth() {
return format(new Date(), webMonthFormat);
}
public static String getChineseYMString(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(chineseYMFormat);
Date datea = sdf.parse(date);
DateFormat dateFormat = getNewDateFormat(chineseYMFormat);
return getDateString(datea, dateFormat);
}
public static Date getPreMonthDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat(webMonthFormat);
Date datea = sdf.parse(date);
Calendar cal = Calendar.getInstance();
cal.setTime(datea);
cal.add(Calendar.MONTH, -1);
return cal.getTime();
}
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
前端框架
前端框架太多了,真的学不动了,别慌,其实对于前端的三大马车,Angular、React、Vue 只要把其中一种框架学明白,底层原理实现,其他两个学起来不会很吃力,这也取决于你以后就职的公司要求你会哪一个框架了,当然,会的越多越好,但是往往每个人的时间是有限的,对于自学的学生,或者即将面试找工作的人,当然要选择一门框架深挖原理。
以 Vue 为例,我整理了如下的面试题。
,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**
深知大多数前端工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Web前端开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
[外链图片转存中…(img-LqERdKaU-1712079691031)]
[外链图片转存中…(img-KTslVBK3-1712079691032)]
[外链图片转存中…(img-B6Qr0pdg-1712079691032)]
[外链图片转存中…(img-5GXdsrG0-1712079691033)]
[外链图片转存中…(img-6yKc2y88-1712079691033)]
[外链图片转存中…(img-tUXuAIbP-1712079691034)]
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上前端开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V获取:vip1024c (备注前端)
[外链图片转存中…(img-oh3INRcE-1712079691034)]
前端框架
前端框架太多了,真的学不动了,别慌,其实对于前端的三大马车,Angular、React、Vue 只要把其中一种框架学明白,底层原理实现,其他两个学起来不会很吃力,这也取决于你以后就职的公司要求你会哪一个框架了,当然,会的越多越好,但是往往每个人的时间是有限的,对于自学的学生,或者即将面试找工作的人,当然要选择一门框架深挖原理。
以 Vue 为例,我整理了如下的面试题。