Click here to Skip to main content
14,130,705 members
Rate this:
Please Sign up or sign in to vote.
See more:
#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
Updated 14-Jul-15 21:02pm
First of all, do you look at your own posts? Did you see that your code sample starts with:


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.

Mohibur Rashid 15-Jul-15 3:09am
You deserve a level 5 thumbs up.
Thank you, Mohibur.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Learn for yourself. Here is some nice explanation.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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");
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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));


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04 | 2.8.190518.1 | Last Updated 15 Jul 2015
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100