类 GetDateMethod

java.lang.Object
com.publiccms.common.base.BaseMethod
com.publiccms.views.method.tools.GetDateMethod
所有已实现的接口:
freemarker.template.TemplateMethodModel, freemarker.template.TemplateMethodModelEx, freemarker.template.TemplateModel

@Component public class GetDateMethod extends BaseMethod
getDate 获取特定日期

参数列表

  1. 日期类型【yesterday:昨天,tomorrow:明天,thisSunday:本周日,thisMonday:本周一,lastMonday:上周一,lastSunday:上周日,lastWeek:上一周,lastMonth:上个月,lastSeason:上季度,lastHalfYear:半年前,lastYear:去年,nextMonday:下周一,nextSunday:下周日,nextWeek:下一周,nextMonth:下个月,nextSeason:下季度,nextHalfYear:半年后,nextYear:明年】,默认当前时间
  2. 日期,【2020-01-01 23:59:59】,【2020-01-01】,为空则取当前日期

返回结果

  • date:日期
使用示例

${getDate('thisSunday','2020-01-01')}

<script>
$.getJSON('${site.dynamicPath}api/method/getDate?parameters=thisSunday&parameters=2020-01-01', function(data){
console.log(data);
});
</script>
 
  • 构造器详细资料

    • GetDateMethod

      public GetDateMethod()
  • 方法详细资料

    • execute

      public Object execute(List<freemarker.template.TemplateModel> arguments) throws freemarker.template.TemplateModelException
      指定者:
      execute 在类中 BaseMethod
      抛出:
      freemarker.template.TemplateModelException
    • needAppToken

      public boolean needAppToken()
      指定者:
      needAppToken 在类中 BaseMethod
      返回:
      whether to need app token
    • minParametersNumber

      public int minParametersNumber()
      指定者:
      minParametersNumber 在类中 BaseMethod
      返回:
      min parameters number
    • getMonday

      static Date getMonday(Date date)
    • getSunday

      static Date getSunday(Date date)