date和calender的区别是什么

date和calender的区别是什么,第1张

说实话,本人一般用的比较多的还是date类,不过后来发现calender还是蛮好用的

应该就是StringBuilder和StringBuffer的区别吧,一个是新类,一个是旧类

看了一下API发现calender大多是静态方法,也就是说用它,你不需要像用date一样转换直接调用其静态方法就可以获得一些像日期,月份呀这些原本比较麻烦的值了比如:创建calender

Calendar rightNow = CalendargetInstance();

而date的用法从jdk10开始就这样没什么变过

1用javautilCalender来实现

Calendar calendar=CalendargetInstance();

calendarsetTime(new Date());

Systemoutprintln(calendarget(CalendarDAY_OF_MONTH));//今天的日期

calendarset(CalendarDAY_OF_MONTH,calendarget(CalendarDAY_OF_MONTH)+1);//让日期加1

Systemoutprintln(calendarget(CalendarDATE));//加1之后的日期Top

===============================================================================

2用javatextSimpleDateFormat和javautilDate来实现

Date d=new Date();

SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");

Systemoutprintln("今天的日期:"+dfformat(d));

Systemoutprintln("两天前的日期:" + dfformat(new Date(dgetTime() - 2 24 60 60 1000)));

Systemoutprintln("三天后的日期:" + dfformat(new Date(dgetTime() + 3 24 60 60 1000)));

DataTable dt;

protected void Page_Load(object sender,EventArgs e)

{

//页面加载时加载日历控件当前月份的数据

dt= thisgetData(thisCalendar1SelectedDateYear, thisCalendar1SelectedDateMonth);

}

//添加日期控件的这个事件

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)

{

for (int i = 0; i < dtRowsCount; i++)

{

DateTime date = (DateTime)dtRows[i][0];

if (dateYear == eDayDateYear && dateMonth == eDayDateMonth && dateDay == eDayDateDay)

{

//有业务时,设置样式

eCellBackColor = SystemDrawingColorRed;

eCellToolTip = "待办事情:" + dtRows[i][1]ToString();

}

}

}

//此处应该根据年、月,从数据库中读取数据,这里只是模拟一下

private DataTable getData(int year, int month)

{

DataTable dt = new DataTable();

dtColumnsAdd("day", TypeGetType("SystemDateTime"));

dtColumnsAdd("information", TypeGetType("SystemString"));

DataRow row = dtNewRow();

row[0] = new DateTime(2008, 12, 08);

row[1] = "3点钟开会";

dtRowsAdd(row);

row = dtNewRow();

row[0] = new DateTime(2008, 12, 10);

row[1] = "金星大厦会见客户";

dtRowsAdd(row);

return dt;

}

您好!

对于问题一:

这个方法的意思是系统当前时间与1970年1月1日0点0分0秒的毫秒差

对于问题二:

下面是实现的方法之一

public static void main(String[] args)

{

Calendar c = CalendargetInstance();

//现在的时间(单位:毫秒)

long nowMills = cgetTimeInMillis();

//第二个参数是设置月的,月是基于0的

//arg list:year,month,day,hour,minute,second

cset(2011, 4, 4, 23, 59, 59);

long setMills = cgetTimeInMillis();

long a=setMills-nowMills;

Systemoutprintln("2011年5月4日距当前时间分钟数:"+a/(601000));

}

希望对你有帮助!

/

@(#)AidyCalenderjava

@author

@version 100 2008/7/19

/

import javaawt;

import javaawtevent;

import javalangStringBuffer;

import javaxswing;

import javautil;

import javaxswingTimer;

import javaxswingborder;

public class AidyCalender extends JFrame implements ActionListener,ItemListener{

Date date = new Date();

private GregorianCalendar gregorianCalendar = new GregorianCalendar();

//定义中英文字符数组存储星期信息,用于转换显示

private String[] stringWeekEn = new String[] { "SUN", "MON", "TUE", "WED",

"THU", "FRI", "SAT" };

private String[] stringWeekCn = new String[] { "星期日", "星期一", "星期二", "星期三",

"星期四", "星期五", "星期六" };

//定义存储月份的信息数组,用于转换显示方示

private String[] stringMonthEn = new String[] { "Jan", "Feb", "Mar", "Apr",

"May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" };

private String[] stringMonthCn = {"一月","二月","三月","四月","五月","六月",

"七月","八月","九月","十月","十一月","十二月"};

private String[] sysNowTime = new String[6];//sysNowTime 用于存储系统时间的变量

private String[] sysRunTime = new String[6];

private JLabel []labelWeek = new JLabel[7];

private JLabel []labelDay = new JLabel[42];

private JLabel labelTime = new JLabel();

private JPanel panel1 = new JPanel();

private JPanel panel2 = new JPanel();

private JPanel panel3 = new JPanel();

private JComboBox combo1 = new JComboBox();

private JComboBox combo2 = new JComboBox();

private JButton buttonToday = new JButton();

private Border border = BorderFactorycreateRaisedBevelBorder();

private Border border1 = BorderFactorycreateLineBorder(Colorcyan,3);

public AidyCalender(String title) {

super(title);

for (int y = 1900; y < 2101; y++) {

combo1addItem(" " + new Integer(y)toString()+"年");

}

for (int m = 0;m<12;m++){

combo2addItem(" "+stringMonthCn[m]);

}

buttonTodaysetText("今 天");

setLayout(new FlowLayout());

add(panel1);

add(panel2);

add(panel3);

panel1setLayout(new GridLayout(1,3,10,0));

panel1add(combo1);

combo1addItemListener(this);

panel1add(combo2);

combo2addItemListener(this);

panel1add(buttonToday);

buttonTodayaddActionListener(this);

labelTimesetFont(new Font("宋体",FontPLAIN,16));

labelTimesetForeground(ColorMAGENTA);

panel1add(labelTime);

Timer time = new Timer(1000,new TimerListener());

timeaddActionListener(new TimerListener());

//timesetRepeats(true);

timestart();

//labelTimeaddAncestorListener(new TimerListener());

panel2setLayout(new GridLayout(7,7,0,10));

panel2setBackground(Colorwhite);

for(int i=0;i<7;i++){

labelWeek[i] = new JLabel();

labelWeek[i]setHorizontalAlignment(0);

if(i==0||i==6){

labelWeek[i]setBackground(Colorblue);

labelWeek[i]setForeground(ColorRED);

labelWeek[i]setFont(new Font("黑体",FontBOLD,14));

}

else{

labelWeek[i]setForeground(ColorBLACK);

labelWeek[i]setFont(new Font("新宋体",FontPLAIN,14));

}

labelWeek[i]setText(stringWeekCn[i]);

panel2add(labelWeek[i]);

}

for(int i= 0;i<42;i++){

labelDay[i] = new JLabel();

labelDay[i]setHorizontalAlignment(0);

labelDay[i]setText("");

panel2add(labelDay[i]);

}

addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent e){

Systemexit(0);

}

});

setSize(300,300);

setBounds(250, 200, 400, 360);

setVisible(true);

setResizable(false);

setDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

getSysDate();

setNowDate();

}

public void actionPerformed(ActionEvent ae){

if(aegetSource()==buttonToday){

setNowDate();

}

}

public void itemStateChanged(ItemEvent aa){

setChangeDate();

}

public int turnWeek(String week){

int i;

for(i=0;i<7;i++)

if(weekequalsIgnoreCase(stringWeekEn[i]))

break;

return i;

}

public int turnMonth(String month){

/

int turnMonth(String month)

@month 系统日期中的月,诸如Jan\Feb

@return int

返回一个整数值,用于寻找stringMonthCn[]数组中对应的中文月份

/

int i;

for(i=0;i<12;i++)

if(monthequalsIgnoreCase(stringMonthEn[i]))

break;

return i;

}

/

setNowDate()

设置当前系统日期

/

public void setNowDate(){

setSysDate(getNowYear(),getNowMonth());

getSysRunDate();

setDateNull();

combo1setSelectedIndex(getShowYear() - 1900);

combo2setSelectedIndex(getShowMonth());

setDays(getMonthDays(getNowYear(),getNowMonth()),getInitWeek(sysRunTime[0]),getNowDay());

//labelTimesetText(sysNowTime[3]);

//labelTimesetHorizontalAlignment(0);

}

/Integer getShowYear()

获取组合框中应该显示的年份

/

public void setSysDate(int year,int month){

gregorianCalendarset(year,month,1);

}

public void setDateNull(){

for(int i=0;i<42;i++){

labelDay[i]setText("");

}

}

public void setChangeDate(){

setSysDate(getComboYear(),getComboMonth());

getSysRunDate();

setDateNull();

setDays(getMonthDays(getComboYear(),getComboMonth()),getInitWeek(sysRunTime[0]),-1);

}

public int getMonthDays(int year, int month) {

/

返回所选年月的天数,因为数组中的数值从0开始,所以3\5\8\10分别代表4\6\9\11几个小月

而1代表2月,经过是否为闰年判断,选择返回28或29天

其余月份为大月,返回31天

/

switch (month) {

case 3:

case 5:

case 8:

case 10:

return 30;//小月返回30天

case 1:

if (gregorianCalendarisLeapYear(year)) {

//isLeapYear(year)确定当前纪元中的指定年份是否为闰年。

return 29;

} else {

return 28;

}//闰年的二月返回29天,平年返回28天

default:

return 31;

//大月返回31天

}

}

/

int getComboYear()

获取组合框中的年份

/

public void getSysDate(){

date = gregorianCalendargetTime();

sysNowTime = (datetoString())split(" ");

}

public void getSysRunDate(){

date = gregorianCalendargetTime();

sysRunTime = (datetoString())split(" ");

}

public int getComboYear(){

return combo1getSelectedIndex()+1900;

}

/

int getComboMonth()

获取月组合框中的整数值,

/

public int getComboMonth(){

return combo2getSelectedIndex();

}

public int getInitWeek(String initWeek){

/

getWeekNow(String initWeek)

@para nowWeek 系统日期中的星期

返回当月中的1号是从星期几开始

/

int nowWeek = 0 ;

for(int i = 0;i<7;i++){

if(initWeekequalsIgnoreCase(stringWeekEn[i])){

nowWeek = i;

break;

}

}

return nowWeek;

}

public int getNowYear(){

return IntegerparseInt(sysNowTime[5]);

}

public int getNowMonth(){

int nowMonth=0;

for(int i=0;i<12;i++){

if(sysNowTime[1]equalsIgnoreCase(stringMonthEn[i]));

nowMonth=i;

break;

}

return nowMonth;

}

public int getNowDay(){

return IntegerparseInt(sysNowTime[2]);

}

public Integer getShowYear(){

return IntegerparseInt(sysNowTime[5]);

}

public Integer getShowMonth(){

/

Integer getShowMonth()

获取在组给框中显示的中文格式月份:如七月\八月等

/

return turnMonth(sysNowTime[1]);

}

public void setDays(int monthDays,int initWeek,int day){

/

void setDays(int monthDays,int initWeek,int day)

@para monthDays 本月天数

@para initWeek 初始星期

@para day 今天日

设置月历

/

setDateNull();

for(int i=initWeek;i<initWeek+monthDays+1;i++){

if((i-initWeek+1)==day){

labelDay[i]setBorder(border1);

labelDay[i]setForeground(ColorBLUE);

labelDay[i]setFont(new Font("黑体",FontBOLD,20));

}else if((i%7==0)||(i%7==6))

labelDay[i]setForeground(ColorRED);

else{

labelDay[i]setForeground(ColorBLACK);

}

labelDay[i]setText(StringvalueOf(i-initWeek+1));

}

for(int i=initWeek+monthDays;i<42;i++)

labelDay[i]setText("");

}

class TimerListener implements ActionListener{

//AdapterDemo var=new AdapterDemo("万年历程序--Aidy");

public void actionPerformed(ActionEvent e) {

GregorianCalendar g = new GregorianCalendar();

String clock = new String((ggetTime()toString()split(" "))[3]);

labelTimesetText(clock);

}

}

public static void main(String args[])

{

try{

UIManagersetLookAndFeel(UIManagergetSystemLookAndFeelClassName());

}catch(Exception e){

throw new RuntimeException(e);

}

AidyCalender var=new AidyCalender("万年历程序--Aidy");

}

}

本文来自CSDN博客,转载请标明出处:>

## 在PostgreSQL 和 Hive中生成日期序列

### Postgresql实现日期序列

在postgresql中,有 generate_series(start_date, end_date, interval)函数来生成日期序列

```

select date(day) as day

from generate_series('2020-05-22'::timestamp, current_date, '1 day'::interval) as day

```

### Hive实现指定指定开始结束日期的日期序列

在Hive中,可以借助 posexplode(list)、datediff(end_date, start_date)来实现。

首先创建一个表名为calender,字段为day,类型为date,存入一个日期数值作为开始日期,比如2014-01-01。

```

CREATE TABLE defaultcalender (day DATE);

INSERT INTO TABLE defaultcalender VALUES(to_date('2014-01-01T00:00'));

```

借助 `datediff(end_date, start_date)`、`space(int_count)`、`split(list,seperator)`、`posexplode(list) `生成n个空格,然后split成list,posexplode将行转多列,同时返回index和value。

```

select date_add(day,idx) as new_day from defaultcalender

lateral view posexplode( split( space( datediff( current_date, to_date('2014-01-01T00:00:00') ) ), ' ')  ) tt as idx, v;

```

中间过程解释:

比如:

```

select datediff('2020-06-30','2020-05-1'); -- 60

select split(space(datediff('2020-06-30','2020-05-1')),' ') -- 生成60个空格,然后split成list

```

index | value

--- | ---

0 | ' '

1 | ' '

2 | ' '

|

59| ' '

#### Hive在日期序列表添加星期几

新增一列存放星期几

```

ALTER TABLE defaultcalender ADD COLUMNS(weekday STRING);

```

借助函数`datediff`,`pmod`就可以实现

datediff 是两个日期相减的函数

语法:`datediff(string enddate, string startdate)`

返回值: int

说明: 返回两个时间参数的相差天数。

pmod 是正取余函数

语法: `pmod(int a, int b),pmod(double a, double b)`

返回值: int double

说明: 返回正的a除以b的余数

选取一个日期为星期日的日期作为参照日期,这里我选取了2013-12-29

`pmod(datediff( date, '2012-01-01'), 7)  `

返回值:int 0-6

0-6分别表示星期日-星期六

```

INSERT OVERWRITE TABLE defaultcalender

select date_add(day,idx) as `date`,

    -- 0-6 分别代表星期日-星期六

    case pmod(datediff(date_add(day,idx), to_date('2013-12-29T00:00:00')), 7)

        when 0 then '星期日'

        when 1 then '星期一'

        when 2 then '星期二'

        when 3 then '星期三'

        when 4 then '星期四'

        when 5 then '星期五'

        when 6 then '星期六'

    END as weekday

from defaultcalender

lateral view posexplode( split( space( datediff( to_date('2030-01-01T00:00:00') , to_date('2014-01-01T00:00:00') ) ), ' ')  ) tt as idx, v;

```

### 补充:Hive实现缺失日期的补全

在统计一些daily的metrics的时候,通常使用group by,往往会存在某些日期没有数据从而导致最后的结果表的日期其实不是连续的齐全序列。

比如:

store_id | date | count

---- | ---- | -----

1 | 2020-04-02 | 45

2 | 2020-04-02 | 10

2 | 2020-04-03 | 10

1 | 2020-04-05 | 50

2 | 2020-04-06 | 10

1 | 2020-04-08 | 50

| |

针对这种情况,需要进行以下步骤拆解:

1 按照store_id进行聚合,找出最小、最大日期

2 此时,基于步骤1的CTE表进行基于每个store_id的最小、最大日期的日期序列补全

```

select tstore_id, date_add(tmin_date, idx) as `date`

    from store_with_min_max_usage_date t

    lateral view posexplode(split(space(datediff(tmax_date, tmin_date)),' ')) pe as idx, v

```

3 将步骤2的结果与之前的agg聚合结果表进行`left join`,对`NULL`用`COALESCE(v, 0)`进行缺失值替换。

java

@author

@version 100 2008/7/19

/

import javaawt;

import javaawtevent;

import javalangStringBuffer;

import javaxswing;

import javautil;

import javaxswingTimer;

import javaxswingborder;

public class AidyCalender extends JFrame implements ActionListener,ItemListener{

Date date = new Date();

private GregorianCalendar gregorianCalendar = new GregorianCalendar();

//定义中英文字符数组存储星期信息,用于转换显示

private String[] stringWeekEn = new String[] { "SUN", "MON", "TUE", "WED",

"THU", "FRI", "SAT" };

private String[] stringWeekCn = new String[] { "星期日", "星期一", "星期二", "星期三",

"星期四", "星期五", "星期六" };

//定义存储月份的信息数组,用于转换显示方示

private String[] stringMonthEn = new String[] { "Jan", "Feb", "Mar", "Apr",

"May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" };

private String[] stringMonthCn = {"一月","二月","三月","四月","五月","六月",

"七月","八月","九月","十月","十一月","十二月"};

private String[] sysNowTime = new String[6];//sysNowTime 用于存储系统时间的变量

private String[] sysRunTime = new String[6];

private JLabel []labelWeek = new JLabel[7];

private JLabel []labelDay = new JLabel[42];

private JLabel labelTime = new JLabel();

private JPanel panel1 = new JPanel();

private JPanel panel2 = new JPanel();

private JPanel panel3 = new JPanel();

private JComboBox combo1 = new JComboBox();

private JComboBox combo2 = new JComboBox();

private JButton buttonToday = new JButton();

private Border border = BorderFactorycreateRaisedBevelBorder();

private Border border1 = BorderFactorycreateLineBorder(Colorcyan,3);

public AidyCalender(String title) {

super(title);

for (int y = 1900; y < 2101; y++) {

combo1addItem(" " + new Integer(y)toString()+"年");

}

for (int m = 0;m<12;m++){

combo2addItem(" "+stringMonthCn[m]);

}

buttonTodaysetText("今 天");

setLayout(new FlowLayout());

add(panel1);

add(panel2);

add(panel3);

panel1setLayout(new GridLayout(1,3,10,0));

panel1add(combo1);

combo1addItemListener(this);

panel1add(combo2);

combo2addItemListener(this);

panel1add(buttonToday);

buttonTodayaddActionListener(this);

labelTimesetFont(new Font("宋体",FontPLAIN,16));

labelTimesetForeground(ColorMAGENTA);

panel1add(labelTime);

Timer time = new Timer(1000,new TimerListener());

timeaddActionListener(new TimerListener());

//timesetRepeats(true);

timestart();

//labelTimeaddAncestorListener(new TimerListener());

panel2setLayout(new GridLayout(7,7,0,10));

panel2setBackground(Colorwhite);

for(int i=0;i<7;i++){

labelWeek[i] = new JLabel();

labelWeek[i]setHorizontalAlignment(0);

if(i==0||i==6){

labelWeek[i]setBackground(Colorblue);

labelWeek[i]setForeground(ColorRED);

labelWeek[i]setFont(new Font("黑体",FontBOLD,14));

}

else{

labelWeek[i]setForeground(ColorBLACK);

labelWeek[i]setFont(new Font("新宋体",FontPLAIN,14));

}

labelWeek[i]setText(stringWeekCn[i]);

panel2add(labelWeek[i]);

}

for(int i= 0;i<42;i++){

labelDay[i] = new JLabel();

labelDay[i]setHorizontalAlignment(0);

labelDay[i]setText("");

panel2add(labelDay[i]);

}

addWindowListener(new WindowAdapter(){

public void windowClosing(WindowEvent e){

Systemexit(0);

}

});

setSize(300,300);

setBounds(250, 200, 400, 360);

setVisible(true);

setResizable(false);

setDefaultCloseOperation(JFrameEXIT_ON_CLOSE);

getSysDate();

setNowDate();

}

public void actionPerformed(ActionEvent ae){

if(aegetSource()==buttonToday){

setNowDate();

}

}

public void itemStateChanged(ItemEvent aa){

setChangeDate();

}

public int turnWeek(String week){

int i;

for(i=0;i<7;i++)

if(weekequalsIgnoreCase(stringWeekEn[i]))

break;

return i;

}

public int turnMonth(String month){

/

int turnMonth(String month)

@month 系统日期中的月,诸如Jan\Feb

@return int

返回一个整数值,用于寻找stringMonthCn[]数组中对应的中文月份

/

int i;

for(i=0;i<12;i++)

if(monthequalsIgnoreCase(stringMonthEn[i]))

break;

return i;

}

/

setNowDate()

设置当前系统日期

/

public void setNowDate(){

setSysDate(getNowYear(),getNowMonth());

getSysRunDate();

setDateNull();

combo1setSelectedIndex(getShowYear() - 1900);

combo2setSelectedIndex(getShowMonth());

setDays(getMonthDays(getNowYear(),getNowMonth()),getInitWeek(sysRunTime[0]),getNowDay());

//labelTimesetText(sysNowTime[3]);

//labelTimesetHorizontalAlignment(0);

}

/Integer getShowYear()

获取组合框中应该显示的年份

/

public void setSysDate(int year,int month){

gregorianCalendarset(year,month,1);

}

public void setDateNull(){

for(int i=0;i<42;i++){

labelDay[i]setText("");

}

}

public void setChangeDate(){

setSysDate(getComboYear(),getComboMonth());

getSysRunDate();

setDateNull();

setDays(getMonthDays(getComboYear(),getComboMonth()),getInitWeek(sysRunTime[0]),-1);

}

public int getMonthDays(int year, int month) {

/

返回所选年月的天数,因为数组中的数值从0开始,所以3\5\8\10分别代表4\6\9\11几个小月

而1代表2月,经过是否为闰年判断,选择返回28或29天

其余月份为大月,返回31天

/

switch (month) {

case 3:

case 5:

case 8:

case 10:

return 30;//小月返回30天

case 1:

if (gregorianCalendarisLeapYear(year)) {

//isLeapYear(year)确定当前纪元中的指定年份是否为闰年。

return 29;

} else {

return 28;

}//闰年的二月返回29天,平年返回28天

default:

return 31;

//大月返回31天

}

}

/

int getComboYear()

获取组合框中的年份

/

public void getSysDate(){

date = gregorianCalendargetTime();

sysNowTime = (datetoString())split(" ");

}

public void getSysRunDate(){

date = gregorianCalendargetTime();

sysRunTime = (datetoString())split(" ");

}

public int getComboYear(){

return combo1getSelectedIndex()+1900;

}

/

int getComboMonth()

获取月组合框中的整数值,

/

public int getComboMonth(){

return combo2getSelectedIndex();

}

public int getInitWeek(String initWeek){

/

getWeekNow(String initWeek)

@para nowWeek 系统日期中的星期

返回当月中的1号是从星期几开始

/

int nowWeek = 0 ;

for(int i = 0;i<7;i++){

if(initWeekequalsIgnoreCase(stringWeekEn[i])){

nowWeek = i;

break;

}

}

return nowWeek;

}

public int getNowYear(){

return IntegerparseInt(sysNowTime[5]);

}

public int getNowMonth(){

int nowMonth=0;

for(int i=0;i<12;i++){

if(sysNowTime[1]equalsIgnoreCase(stringMonthEn[i]));

nowMonth=i;

break;

}

return nowMonth;

}

public int getNowDay(){

return IntegerparseInt(sysNowTime[2]);

}

public Integer getShowYear(){

return IntegerparseInt(sysNowTime[5]);

}

public Integer getShowMonth(){

/

Integer getShowMonth()

获取在组给框中显示的中文格式月份:如七月\八月等

/

return turnMonth(sysNowTime[1]);

}

public void setDays(int monthDays,int initWeek,int day){

/

void setDays(int monthDays,int initWeek,int day)

@para monthDays 本月天数

@para initWeek 初始星期

@para day 今天日

设置月历

/

setDateNull();

for(int i=initWeek;i<initWeek+monthDays+1;i++){

if((i-initWeek+1)==day){

labelDay[i]setBorder(border1);

labelDay[i]setForeground(ColorBLUE);

labelDay[i]setFont(new Font("黑体",FontBOLD,20));

}else if((i%7==0)||(i%7==6))

labelDay[i]setForeground(ColorRED);

else{

labelDay[i]setForeground(ColorBLACK);

}

labelDay[i]setText(StringvalueOf(i-initWeek+1));

}

for(int i=initWeek+monthDays;i<42;i++)

labelDay[i]setText("");

}

class TimerListener implements ActionListener{

//AdapterDemo var=new AdapterDemo("万年历程序--Aidy");

public void actionPerformed(ActionEvent e) {

GregorianCalendar g = new GregorianCalendar();

String clock = new String((ggetTime()toString()split(" "))[3]);

labelTimesetText(clock);

}

}

public static void main(String args[])

{

try{

UIManagersetLookAndFeel(UIManagergetSystemLookAndFeelClassName());

}catch(Exception e){

throw new RuntimeException(e);

}

AidyCalender var=new AidyCalender("万年历程序--Aidy");

}

}

本文来自CSDN博客,转载请标明出处:

以上就是关于date和calender的区别是什么全部的内容,包括:date和calender的区别是什么、java按照时间查询,获取近1月时间信息。时间如何加减简单易懂,谢谢了。、ASP.NET Calendar控件等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/9503162.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-29
下一篇 2023-04-29

发表评论

登录后才能评论

评论列表(0条)

保存