Back to project page Joetz-Android-V2.
The source code is released under:
GNU General Public License
If you think the Android project Joetz-Android-V2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example.jens.myapplication.domain.converter; // w w w. j av a 2 s . com import org.joda.time.DateTime; /** * Created by Sam on 26/10/2014. */ public class UnixDateTimeConverter { /** * Converts a DaetTime object into a unix timestamp * @param date The date to be converted * @return The unix timestamp for the given date */ public static long getUnix(DateTime date){ if(date == null){ return 0; } return (int) (date.getMillis() / 1000); } /** * Converts a unix timestamp into a DateTime object * @param unixTime The unix timestamp to be converted * @return The corresponding DateTime object */ public static DateTime getDate(long unixTime){ return new DateTime(unixTime * 1000L); } }