java date after_java.util.Date after方法

java.util.Date after方法

java.util.Date.after() 方法用于测试日期是否在指定的日期之后。

1 语法

public boolean after(Date when)

2 参数

when:指定日期

3 返回值

如果此日期晚于指定日期,则返回布尔值true。否则,返回false。

4 示例1

package com.yiidian;

/**

* 一点教程网: http://www.yiidian.com

*/

/**

* java.util.Date after方法的例子

*/

import java.util.Date;

public class JavaDateAfterExample1 {

public static void main(String[] args) {

Date d=new Date(2018,9,21);

Date d2=new Date(1997,3,10);

System.out.println("Date 'd' is after Date 'd2' : "+d.after(d2));

}

}

输出结果为:

Date 'd' is after Date 'd2' : true

5 示例2

package com.yiidian;

/**

* 一点教程网: http://www.yiidian.com

*/

/**

* java.util.Date after方法的例子

*/

import java.util.Date;

public class JavaDateAfterExample2 {

public static void main(String[] args) {

Date d=new Date(1997,3,10);

Date d2=new Date(2018,9,21);

System.out.println("Date 'd' is after Date 'd2' : "+d.after(d2));

}

}

输出结果为:

Date 'd' is after Date 'd2' : false

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
import com.pmstation.spss.DataConstants; import com.pmstation.spss.MissingValue; import com.pmstation.spss.SPSSWriter; import com.pmstation.spss.ValueLabels; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Date; public class Demo { // Entrance point public static void main(String args[]) { try { // Parse the command line if (args.length != 1) { printUsageAndExit(); } // Open file output stream with filename args[0] OutputStream out = new FileOutputStream(args[0]); // Assign SPSS output to the file SPSSWriter outSPSS = new SPSSWriter(out, "utf-8"); // Creating SPSS variable description table outSPSS.setCalculateNumberOfCases(false); outSPSS.addDictionarySection(-1); // Describing varible names and types outSPSS.addStringVar("continent", 255, "Continents of the world"); outSPSS.addNumericVar("size", 8, 2, "Sq km"); outSPSS.addNumericVar("population", 8, 2, "Population"); // Create missing value MissingValue mv = new MissingValue(); mv.setOneDescreteMissingValue(1); outSPSS.addNumericVar("countries", 8, 2, "Number of countries", mv); outSPSS.addDateVar("update", DataConstants.DATE_TYPE_17, "Date of last update", null); // Create value labels ValueLabels valueLabels = new ValueLabels(); valueLabels.putLabel("Asia", "Asia Continent"); valueLabels.putLabel("America", "America Continent"); outSPSS.addValueLabels(1, valueLabels); valueLabels = new ValueLabels(); valueLabels.putLabel(0, "No Countries"); valueLabels.putLabel(23, "Twenty Three Countries"); outSPSS.addValueLabels(4, valueLabels); outSPSS.addStringVar("description", 2200, "Description"); // Create SPSS variable value define table outSPSS.addDataSection(); // Add values for all defined variables

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值