Back to project page rfcx-guardian-android.
The source code is released under:
Apache License
If you think the Android project rfcx-guardian-android 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 org.rfcx.guardian.utility; //from www .j av a 2 s . c o m import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import android.util.Log; public class DateTimeUtils { private static final String TAG = DateTimeUtils.class.getSimpleName(); private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US); public String getDateTime() { Date date = new Date(); return dateFormat.format(date); } public String getDateTime(Date date) { return dateFormat.format(date); } public Date getDateFromString(String dateString) { try { return dateFormat.parse(dateString); } catch (ParseException e) { Log.e(TAG, e.getMessage()); return new Date(); } } }