1

I have simple calender function which gets the the current date time. I want to convert the Date to unix time stamp format before passsing it as json.

my code :

SimpleDateFormat s = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
                final String format = s.format(new Date());
Tushar Narang
  • 1,997
  • 3
  • 21
  • 49

1 Answers1

2

The answer is simple just add one line and add "unixTime" where u send json

long unixTime = System.currentTimeMillis() / 1000L;
Tushar Narang
  • 1,997
  • 3
  • 21
  • 49