getsystemtime.java

来自「java web开发技术方案宝典」· Java 代码 · 共 23 行

JAVA
23
字号
package com.tool;

import java.util.Calendar;

public class GetSystemTime {

	private Calendar now = Calendar.getInstance();
	private int year = now.get(Calendar.YEAR);
	private int month = now.get(Calendar.MONTH) + 1;
	private int day = now.get(Calendar.DAY_OF_MONTH);
	public String getToday() {
		String today = this.year + "-" + this.month + "-" + this.day;
		return today;
	}

	public static void main(String[] args) {
		GetSystemTime systemTime = new GetSystemTime();
		System.out.println(systemTime.getToday());

	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?