Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
C
#include <stdio.h>
#include <stdint.h>
void main()
{
       uint64_t sec = 1435237366;
       printf( "time is  %s\n", asctime(localtime(&sec)));
}

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

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

thank you
Posted
Updated 14-Jul-15 21:02pm
v2
Comments
Sergey Alexandrovich Kryukov 15-Jul-15 2:24am    
First of all, do you look at your own posts? Did you see that your code sample starts with:

#include
#include

I understand that's the artifact of wrong HTML formatting, but who do you think needs to fix it?

There is no "convert". Just learn Java and write what you want. You did not tell us what do you want to achieve.

—SA
Mohibur Rashid 15-Jul-15 3:09am    
You deserve a level 5 thumbs up.
Sergey Alexandrovich Kryukov 15-Jul-15 6:55am    
Thank you, Mohibur.
—SA

Learn for yourself. Here is some nice explanation.
 
Share this answer
 
Try something like:
Java
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));
  }
}
 
Share this answer
 
C#
import java.util.Date;
public class timeconv {

       public static void main(String[] args) {
              long msec = 1435237366;
              System.out.println("time is " + new Date(msec * 1000));
       }

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900