如何将以下c代码转换为java [英] How do I convert the following c code to java

查看:159
本文介绍了如何将以下c代码转换为java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

#include <stdio.h>
#include <stdint.h>
void main()
{
       uint64_t sec = 1435237366;
       printf( "time is  %s\n", asctime(localtime(&sec)));
}



要在linux中编译,请发出以下命令。


To compile in linux issue the following commmand.

gcc filename.c -o file





输出看起来像



Output looks like

$ ./file
time is  Thu Jun 25 22:02:46 2015



有谁可以帮助我在java中做同样的事情。



谢谢


can anyone please help me to do the same it in java.

thank you

推荐答案

./ file
time is Thu Jun 25 22:02 :46 2015
./file time is Thu Jun 25 22:02:46 2015



有人可以帮我在java中做同样的事。



谢谢


can anyone please help me to do the same it in java.

thank you


自学。这是一些不错的解释
Learn for yourself. Here is some nice explanation.


尝试类似:

Try something like:
public class JDT
{
  public static void main(String args[])
  {
    long millisec = 1435237366000L;
    java.util.Date dt = new java.util.Date(millisec);
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy");
    System.out.println(sdf.format(dt));
  }
}


这篇关于如何将以下c代码转换为java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆