Java中將毫秒轉化爲日期的方法

將毫秒轉化爲日期

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(“”);

}

}

}