首页 > 互联网 > IT认证 > SUN认证 > Java中将毫秒转化为日期的方法

Java中将毫秒转化为日期的方法

   来源:学问社    阅读: 1.48W 次
字号:

用手机扫描二维码 在手机上继续观看

手机查看

将毫秒转化为日期

Java中将毫秒转化为日期的方法

import erLayout;

import e;import Area;

import Field;

import onEvent;

import onListener;

import owAdapter;

import owEvent;

import leDateFormat;

import ;

public class ConvertLong2Date extends Frame

{

TextField tf = new TextField();

TextArea ta = new TextArea();

public static void main(String[] args)

{

new ConvertLong2Date()。launchFrame();

}

public String convertL2D(long l)

{

long _l = 0L;

Date _d = null;

SimpleDateFormat _sdf = null;

String _s = null;

_l = l;

_d = new Date(_l);

_sdf = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);

_s = _at(_d);

return _s;

}

public void launchFrame()

{

setLocation(300, 300);

setSize(480, 320);

setResizable(false);

add(tf,H);

add(ta,H);

pack();

ctionListener(new tfActionListener());

isible(true);

indowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

(0);

}

});

}

public class tfActionListener implements ActionListener

{

public void actionPerformed(ActionEvent e)

{

long l = eLong(ext());

ext(new ConvertLong2Date()。convertL2D(l));

ext(“”);

}

}

}

EDA技术
嵌入式
J2EE
ACCP
JAVA认证
SUN认证
Linux认证
Adobe认证