日期和时间

在webspider中,所以的日期都是UtilDate类型。

UtilDate构造方法:

1.UtilDate (String date),使用默认模式构造日期。

2.UtilDate (String pattern, String date),使用指定模式构造日期。

返回日期方法:

1.String toString(),以默认模式返回。

2.String toString(String pattern),以指定模式返回。

其他实用方法:

boolean isMorning(),日期(UtilDate)是否是早上。

int getMinute(),返回分钟;String getTwoDigitMinute(),以2位字串的形式返回分钟;boolean onSameMinuteAs(WebDate date),如果当前时间与给定时间分钟相同,则返回true。

小时、天、月、年有与分钟相似方法。

常用模式:

  • d - days
  • M - months
  • h - hours (12小时制)
  • H - hours (24小时制)
  • m - minutes
  • s - seconds
  • a - morning or afternoon (am/pm)
  • dd - days (two digit)
  • MM - months (two digit)
  • hh - hours (two digit, 12小时制)
  • HH - hours (two digit, 24小时制)
  • mm - minutes (two digit)
  • yy - months (two digit)
  • yyyy - months (four digit)


"dd/MM/yy-HH:mm" - 默认模式.

 

转载于:https://my.oschina.net/u/1036425/blog/135002

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值