当前位置: 首页 > news >正文

做网站联系我们在那个板块里面网站特效怎么做的

做网站联系我们在那个板块里面,网站特效怎么做的,注册网站要求,网站建设后台管理实训报告1. 正则表达式 1.1 普通字符 字符描述示例[abc]匹配 […] 中所有字符[hlo] 匹配字符串 hello world 中所有的 h l o 字母[^ABC]匹配除了 […] 中所有字符[hlo] 匹配字符串 hello world 中除了 h l o 的所有字母[^a-z]匹配除了 […] 中所有字符[hlo] 匹…1. 正则表达式 1.1 普通字符 字符描述示例[abc]匹配 […] 中所有字符[hlo] 匹配字符串 hello world 中所有的 h l o 字母[^ABC]匹配除了 […] 中所有字符[hlo] 匹配字符串 hello world 中除了 h l o 的所有字母[^a-z]匹配除了 […] 中所有字符[hlo] 匹配字符串 hello world 中除了 a 到 z 的所有字母[A-Z][A-Z] 表示一个区间匹配所有的大写字母[A-Z] 匹配字符串 Hello world 结果为 H 1.2 特殊字符 字符描述示例.匹配任意单个字符除了换行符a.b、1.2*匹配前一个字符零次或多次go*gle、colou*r匹配前一个字符一次或多次gogle、colour?匹配前一个字符零次或一次colou?r、col(o)?r|表示“或”的意思用于匹配多个选项中的一个apple|orange、yes|no[]用于定义字符类匹配方括号内的任意一个字符[aeiou]、[0-9]()用于分组可以改变默认的优先级和应用限定符(go)、(abc|def)$匹配输入字符串的结尾位置如果设置了 RepExp 对象的 Multiline 属性则 $ 也匹配‘\n’或‘\r’…{标记限定表达式的开始…|指明两项直接的一个选择… 1.3 非打印字符 字符描述示例\n匹配换行符Hello\nWorld\r匹配回车符Hello\rWorld\t匹配制表符Hello\tWorld\v匹配垂直制表符Hello\vWorld\s匹配任意空白字符包括空格、制表符、换页符等Hello World\S匹配任意非空白字符不包括换行我暂时不知道\d匹配任意数字字符相当于 [0-9]12345、9am\w匹配任意字母、数字或下划线字符相当于 [a-zA-Z0-9_]hello_world_123 1.4 限定符 字符描述示例*匹配前一个字符零次或多次go*gle、colou*r匹配前一个字符一次或多次gogle、colour?匹配前一个字符零次或一次colou?r、col(o)?r{n}匹配前一个字符恰好出现 n 次go{2}gle、colou{3}r{n,}匹配前一个字符至少出现 n 次go{2,}gle、colou{3,}r{n,m}匹配前一个字符出现 n 到 m 次go{2,5}gle、colou{3,7}r 1.5 定位符 字符描述示例^匹配字符串的开头^Hello、^[A-Z]$匹配字符串的结尾World$、[0-9]$\b匹配单词的边界\btest\b、\bword\b\B匹配非单词边界\Btest\B、\Bword\B 2. 日期时间 2.1 Date 类方法 Date类位于 java.util 包中用于表示特定的时间点。 方法描述getTime()返回自 1970 年 1 月 1 日 00:00:00 GMT 以来的毫秒数。toString()将日期对象转换为字符串形式。compareTo(Date anotherDate)比较两个日期的顺序。返回值为 0 表示相等大于 0 表示当前日期在参数日期之后小于 0 表示当前日期在参数日期之前。equals(Object obj)检查该日期对象是否等于另一个日期对象。before(Date when)检查当前日期是否在指定日期之前。after(Date when)检查当前日期是否在指定日期之后。setTime(long time)设置日期对象的时间值。 例题1 : Date使用 public class DateDemo01 {public static void main(String[] args) {// 创建一个表示当前时间的 Date 对象Date date new Date();System.out.println(date); // Thu Aug 24 22:35:10 CST 2023// 获取 Date 对象的时间毫秒数long timeInMillis date.getTime();System.out.println(timeInMillis); // 1692887710157// 创建一个指定时间的 Date 对象Date specifiedDate new Date(1640886000000L);System.out.println(specifiedDate); // Fri Dec 31 01:40:00 CST 2021// 比较两个 Date 对象的时间boolean isBefore date.before(specifiedDate);boolean isEquals date.equals(specifiedDate);boolean isAfter date.after(specifiedDate);System.out.println(isBefore); // falseSystem.out.println(isEquals); // falseSystem.out.println(isAfter); // true} }2.2 Calendar 类方法 Calender 类是 java 中用于处理日期和时间的类位于 java.util 包中。它提供了一种比 Date 类更灵活和功能更强大的日期和时间操作方式。 方法描述getTime()返回一个表示此 Calendar 时间值从历元到现在毫秒偏移量的 Date 对象。get(int field)返回给定日历字段的值。set(int field, int value)设置给定日历字段的值。add(int field, int amount)根据日历的规则将指定的时间量添加到给定日历字段。roll(int field, int amount)根据日历的规则将给定的时间量添加到给定日历字段但不更改较大的字段值。getActualMaximum(int field)返回指定日历字段的最大值。getActualMinimum(int field)返回指定日历字段的最小值。getDisplayName(int field, int style, Locale locale)返回给定字段值的本地化表示名称。getFirstDayOfWeek()返回一个代表每周的第一天的值。setFirstDayOfWeek(int value)设置一星期中的第一天是哪一天。getMinimum(int field)返回给定日历字段的最小值。getMaximum(int field)返回给定日历字段的最大值。 例题2 : Calender使用 import java.util.Calendar; import java.util.Date;public class CalenderDemo01 {public static void main(String[] args) {// 获取当前时间和日期的 Calender 对象Calendar calendar Calendar.getInstance();System.out.println(calendar); // java.util.GregorianCalendar[time1692889224235,areFieldsSettrue,···]// 设置日期为指定的年份、月份和日 1970年2月1日calendar.set(1970, 1, 1);System.out.println(calendar); // java.util.GregorianCalendar[time?,areFieldsSetfalse,areAllField···]// 获取年份int year calendar.get(Calendar.YEAR);System.out.println(year); // 1970// 获取月份(月份从 0 开始计数)int month calendar.get(Calendar.MONTH) 1;System.out.println(month); // 2// 获取当前月份中的第几天int dayOfMonth calendar.get(Calendar.DAY_OF_MONTH);System.out.println(dayOfMonth); // 1// 月份加 1calendar.add(Calendar.MONTH, 1);// 输出修改过后的月份System.out.println(calendar.getTime()); // Sun Mar 01 23:00:24 CST 1970// 将 Calender 转换为 Date 对象Date date calendar.getTime();System.out.println(date); // Sun Mar 01 23:00:24 CST 1970} }Calender 和 Date 相互转换 import java.util.Calendar; import java.util.Date;public class CalenderDeom02 {// 创建一个 Calender 对象public static void main(String[] args) {Calendar calendar Calendar.getInstance();// 设置日期为指定的日期calendar.set(1970, 0, 1);// 获取当前的日期和时间Date date calendar.getTime();System.out.println(date); // Thu Jan 01 23:25:45 CST 1970// 将 Calender 转换为 DateDate convertedDate calendar.getTime();System.out.println(convertedDate); // Thu Jan 01 23:25:45 CST 1970// 创建一个新的 Date 对象Date newDate new Date(70, 1, 1);// 将 Date 转换为 Calender Calendar convertedCalender Calendar.getInstance();convertedCalender.setTime(newDate);System.out.println(convertedCalender); // java.util.GregorianCalendar[time2649600000,areFieldsSettrue,areAllFieldsSettrue...} }请注意尽管 Date 类和 Calendar 类仍然存在于 Java 中但在 Java 8 及更高版本中推荐使用新版的日期时间类如 LocalDate、LocalTime、LocalDateTime来替代旧版的 Date 和 Calendar 类因为新版的类更加简洁、易用并且线程安全。 2.3 SimpleDateFormat 类方法 SimpleDateFormat 类是 Java 中用于日期和时间格式化的类它位于 java.text 包中。它允许将 Date 对象格式化为指定的日期和时间字符串或将日期和时间字符串解析为 Date 对象。 方法描述SimpleDateFormat(String pattern)使用指定的日期模式创建一个 SimpleDateFormat 对象。String format(Date date)将给定的 Date 对象格式化为字符串使用 SimpleDateFormat 的日期模式。Date parse(String source)将给定的字符串解析为 Date 对象使用 SimpleDateFormat 的日期模式。void setLenient(boolean lenient)设置解析过程是否宽松即是否严格遵循日期格式。String toPattern()返回当前日期模式。void applyPattern(String pattern)使用给定的日期模式更新当前日期模式。DateFormatSymbols getDateFormatSymbols()获取与该日期格式化程序相关联的 DateFormatSymbols 对象用于获取或设置本地化信息如月名、星期几名等。void setDateFormatSymbols(DateFormatSymbols newFormatSymbols)设置与该日期格式化程序相关联的 DateFormatSymbols 对象用于设置本地化信息如月名、星期几名等。 例题3 SimpleDateFormatExample使用 import java.text.SimpleDateFormat; import java.util.Date;public class SimpleDateFormatExample {public static void main(String[] args) {Date date new Date();// 创建 SimpleDateFormat 对象并指定格式化模式,默认2023/8/25 上午10:59SimpleDateFormat sdf new SimpleDateFormat(yyyy-MM-dd a HH:mm:ss:SSS);// 格式化 Date 对象为字符串String formatDate sdf.format(date);System.out.println(formatDate); // 2023-08-25 上午 11:02:59:178// 解析字符串为 Date 对象String dateString 1949-10-01 下午 3:30:45:123;try {Date parsedDate sdf.parse(dateString);System.out.println(parsedDate);} catch (Exception e) {e.printStackTrace();}} }2.4 LocalDate 类方法 LocalDate 是 Java 中的一个日期类它提供了处理日期的方法和功能。LocalDate 类位于 java.time 包中从 JDK 8 引入。LocalDate 是不可变类型final 修饰储存值的数组。 方法描述static LocalDate now()返回当前日期。static LocalDate of(int year, int month, int dayOfMonth)根据指定的年、月、日创建一个 LocalDate 对象。int getYear()获取日期中的年份。Month getMonth()获取日期中的月份返回一个 Month 枚举对象。int getDayOfMonth()获取日期中的月份中的天数。DayOfWeek getDayOfWeek()获取日期中的星期几返回一个 DayOfWeek 枚举对象。LocalDate plusDays(long daysToAdd)返回当前日期加上指定天数后的日期。LocalDate minusDays(long daysToSubtract)返回当前日期减去指定天数后的日期。boolean isBefore(LocalDate other)检查当前日期是否在另一个日期之前。boolean isAfter(LocalDate other)检查当前日期是否在另一个日期之后。boolean isEqual(LocalDate other)检查当前日期是否等于另一个日期。String format(DateTimeFormatter formatter)将日期格式化为指定的字符串格式。 例题4 : LocalDate使用 import java.time.LocalDate; import java.time.Month; import java.time.format.DateTimeFormatter;public class LocalDateDemo01 {public static void main(String[] args) {// 创建 LocalDate 对象LocalDate today LocalDate.now(); // 当前日期创建对象System.out.println(today); // 2023-08-25LocalDate specificDate LocalDate.of(1970, 1, 1); // 指定日期创建对象System.out.println(specificDate specificDate); // 1970-01-01// 解析字符串为 LocalDate 对象LocalDate parseDate LocalDate.parse(1949-10-01);System.out.println(parseDate parseDate); // 1949-10-01// 获取日期信息int year today.getYear();System.out.println(年份 year); // 年份2023Month month today.getMonth();System.out.println(月份 month); // AUGUSTint mon today.getMonthValue();System.out.println(月份 mon); // 8int day today.getDayOfYear(); // 一年中的第几天System.out.println(day); // 237int day1 today.getDayOfMonth(); // 当月的第多少天System.out.println(day1); // 25// 增加、减少日期LocalDate futureDate specificDate.plusDays(7);System.out.println(增加日期: futureDate); // 增加日期:1970-01-08LocalDate pastDate specificDate.minusMonths(1);System.out.println(减少日期: pastDate); // 减少日期:1969-12-01// 判定日期关系boolean isBefore specificDate.isBefore(parseDate);System.out.println(isBefore); // falseboolean isAfter specificDate.isAfter(parseDate);System.out.println(isAfter); // trueboolean isEqual specificDate.isEqual(parseDate);System.out.println(isEqual); // false// 格式化日期DateTimeFormatter formatter DateTimeFormatter.ofPattern(yyyy-MM-dd);String fomattedDate specificDate.format(formatter);System.out.println(格式化后的日期 fomattedDate); // 格式化后的日期1970-01-01} } Date 和 LocalDate 相互转换 import java.time.LocalDate; import java.time.ZoneId; import java.util.Date;public class DateLocalDateConversionExample {public static void main(String[] args) {//将Date对象转换为LocalDate对象Date date new Date();LocalDate localDate dateToLocalDate(date);System.out.println(localDate);// 将LocalDate对象转换为Date对象LocalDate localDate1 LocalDate.of(1970, 1, 1);Date convertedDate localDatetoDate(localDate1);System.out.println(convertedDate);}// 将LocalDate对象转换为Date对象private static Date localDatetoDate(LocalDate localDate1) {ZoneId zoneId ZoneId.systemDefault();return Date.from(localDate1.atStartOfDay(zoneId).toInstant());}// 将Date对象转换为LocalDate对象private static LocalDate dateToLocalDate(Date date) {ZoneId zoneId ZoneId.systemDefault();return date.toInstant().atZone(zoneId).toLocalDate();} }2.5 LocalTime 类方法 LocalTime 是 Java 中的一个时间类它提供了处理时间的方法和功能。LocalDate 类位于 java.time 包中从 JDK 8 引入。LocalTime 是不可变类型final 修饰储存值的数组。 方法描述static LocalTime now()返回当前时间。static LocalTime of(int hour, int minute)根据指定的小时和分钟创建一个 LocalTime 对象。int getHour()获取时间中的小时数。int getMinute()获取时间中的分钟数。int getSecond()获取时间中的秒数。LocalTime plusHours(long hoursToAdd)返回当前时间加上指定小时数后的时间。LocalTime minusHours(long hoursToSubtract)返回当前时间减去指定小时数后的时间。LocalTime plusMinutes(long minutesToAdd)返回当前时间加上指定分钟数后的时间。LocalTime minusMinutes(long minutesToSubtract)返回当前时间减去指定分钟数后的时间。LocalTime plusSeconds(long secondsToAdd)返回当前时间加上指定秒数后的时间。LocalTime minusSeconds(long secondsToSubtract)返回当前时间减去指定秒数后的时间。boolean isBefore(LocalTime other)检查当前时间是否在另一个时间之前。boolean isAfter(LocalTime other)检查当前时间是否在另一个时间之后。boolean isEqual(LocalTime other)检查当前时间是否等于另一个时间。String format(DateTimeFormatter formatter)将时间格式化为指定的字符串格式。 例题5 : LocalTime使用 import java.time.LocalTime; import java.time.format.DateTimeFormatter;public class LocalTimeDemo01 {public static void main(String[] args) {// 创建 LocalTime 对象LocalTime now LocalTime.now();System.out.println(当前时间 now); // 当前时间19:56:31.828827500LocalTime specificTime LocalTime.of(14, 30);System.out.println(指定时间 specificTime); // 指定时间14:30// 解析字符串为 loCalTime 对象LocalTime parsedTime LocalTime.parse(08:45:30);System.out.println(解析后的时间 parsedTime); // 解析后的时间08:45:30// 获取时间信息int hour now.getHour();System.out.println(小时数 hour); // 小时数19int minute now.getMinute();System.out.println(分钟数 minute); // 分钟数56int second now.getSecond();System.out.println(秒数 second); // 秒数31// 增加、减少时间LocalTime futureTime now.plusHours(3);System.out.println(未来时间: futureTime); // 未来时间:22:56:31.828827500LocalTime pastTime now.minusMinutes(15);System.out.println(过去时间: pastTime); // 过去时间:19:41:31.828827500// 判定时间关系boolean isBefore now.isBefore(specificTime);System.out.println(isBefore); // falseboolean isEqusl pastTime.equals(futureTime);System.out.println(isEqusl); // falseboolean isAfter pastTime.isAfter(futureTime);System.out.println(isAfter); // false// 格式化时间DateTimeFormatter formatter DateTimeFormatter.ofPattern(HH:mm:ss);String formattedTime now.format(formatter);System.out.println(formattedTime); // 19:56:31} }在判定日期时间关系中日期是否相等为 isEqual() 时间为 equals() 。 2.6 LocalDateTime 类方法 LocalDateTime 是 Java 中的一个日期时间类LocalDate 类位于 java.time 包中从 JDK 8 引入。它结合了 LocalDate 和 LocalTime 的功能用于表示日期和时间的组合。 方法描述static LocalDateTime now()返回当前日期和时间。static LocalDateTime of(int year, int month, int dayOfMonth, int hour, int minute)根据指定的年、月、日、小时和分钟创建一个 LocalDateTime 对象。LocalDate toLocalDate()获取 LocalDateTime 对象中的日期部分返回一个 LocalDate 对象。LocalTime toLocalTime()获取 LocalDateTime 对象中的时间部分返回一个 LocalTime 对象。int getYear()获取日期时间中的年份。Month getMonth()获取日期时间中的月份返回一个 Month 枚举对象。int getDayOfMonth()获取日期时间中的月份中的天数。int getHour()获取时间中的小时数。int getMinute()获取时间中的分钟数。LocalDateTime plusDays(long daysToAdd)返回当前日期时间加上指定天数后的日期时间。LocalDateTime minusDays(long daysToSubtract)返回当前日期时间减去指定天数后的日期时间。LocalDateTime plusHours(long hoursToAdd)返回当前日期时间加上指定小时数后的日期时间。LocalDateTime minusHours(long hoursToSubtract)返回当前日期时间减去指定小时数后的日期时间。LocalDateTime plusMinutes(long minutesToAdd)返回当前日期时间加上指定分钟数后的日期时间。LocalDateTime minusMinutes(long minutesToSubtract)返回当前日期时间减去指定分钟数后的日期时间。LocalDateTime plusSeconds(long secondsToAdd)返回当前日期时间加上指定秒数后的日期时间。LocalDateTime minusSeconds(long secondsToSubtract)返回当前日期时间减去指定秒数后的日期时间。boolean isBefore(LocalDateTime other)检查当前日期时间是否在另一个日期时间之前。boolean isAfter(LocalDateTime other)检查当前日期时间是否在另一个日期时间之后。boolean isEqual(LocalDateTime other)检查当前日期时间是否等于另一个日期时间。String format(DateTimeFormatter formatter)将日期时间格式化为指定的字符串格式。 例题6 : LocalDateTime使用 import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter;public class LocalDateTimeDemo {public static void main(String[] args) {// 创建 LocalDateTime 对象LocalDateTime now LocalDateTime.now();LocalDateTime specificDateTime LocalDateTime.of(1949, 10, 1, 14, 20);System.out.println(指定日期时间 specificDateTime); // 指定日期时间1949-10-01T14:20// 解析字符串为 LocalDateTime 对象LocalDateTime parsedDateTime LocalDateTime.parse(1970-01-01T09:00:00);System.out.println(解析后的日期时间 parsedDateTime); // 解析后的日期时间1970-01-01T09:00// 获取日期时间信息LocalDate date specificDateTime.toLocalDate();System.out.println(日期部分 date); // 日期部分1949-10-01int year specificDateTime.getYear();System.out.println(年份 year); // 年份1949int minute specificDateTime.getMinute();System.out.println(分钟数 minute); // 分钟数20// 减少、增加日期时间LocalDateTime futureDateTime specificDateTime.plusDays(7).plusHours(3);System.out.println(增加日期时间 futureDateTime); // 增加日期时间1949-10-08T17:20// 判定日期时间关系boolean isEqual parsedDateTime.isEqual(specificDateTime);System.out.println(isEqual); // false// 格式化日期时间DateTimeFormatter formatter DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss:SSS);String formattedDateTime parsedDateTime.format(formatter);System.out.println(格式化后的日期时间为 formattedDateTime); // 格式化后的日期时间为1970-01-01 09:00:00:000} }
http://www.yingshimen.cn/news/62522/

相关文章:

  • 北京城乡住房建设部网站玉林网站建设培训
  • 永康市住房和城乡建设局网站互联网广告行业
  • 自建网站做外贸的流程室内设计工作室简介
  • 原来做网站后来跑国外了网站开发需要学php吗
  • 曾经做网站网站代理成都商城网站建设地址
  • 哈尔滨网络推广应用关键词优化
  • 个人备案网站做淘宝客可以用吗h5企业网站模板 下载
  • 长沙网站建设公司哪家好苏州seo专家教优化网站结构
  • 网站建设助手apache新建网站
  • 国外设计网站app吗网站在线布局
  • 郑州做企业网站的网站开发有没有前途
  • 怎么做自己的优惠价网站怎么做网络推广方案
  • 广安网站建设推荐天津建设工程信息网如何投标报名
  • 宁远做网站msoer网站是怎么建成的
  • 河北省建设环境备案网站上海浦东做网站
  • 佛山正规网站建设哪家好做销售用什么网站好
  • 网站开发绑定微信qq注册长垣有做网站设计的吗
  • 网站可以在外地备案吗wordpress 火车头 教程
  • 技术支持 合肥网站建设杭州设计公司老板被点火
  • 江西省工程建设信息官方网站免费平面设计软件有哪些
  • 漯河网站制作一站式建站企业网站和
  • 装修效果图网站推荐福建做网站公司
  • 网站建设论文百度云盘app可以查的内容
  • 网站在哪里搜索在手机上自己制作游戏软件
  • 网站空间租用多少钱宁波网站制作优化服务
  • 免费制作网站服务器小程序开发公司制作
  • 软文网站模板工信部网站域名备案查询
  • 怎么建设查询网站php给个网站你们知道的
  • 鹤壁做网站推广做网站注册公司
  • 设计师用的素材网站有哪些相城区建设局网站