|
|
@ -17,31 +17,29 @@
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package org.isoron.uhabits.core.utils;
|
|
|
|
package org.isoron.uhabits.core.utils
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.*;
|
|
|
|
import java.text.SimpleDateFormat
|
|
|
|
|
|
|
|
import java.util.Locale
|
|
|
|
|
|
|
|
import java.util.TimeZone
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.*;
|
|
|
|
class DateFormats {
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class DateFormats
|
|
|
|
companion object {
|
|
|
|
{
|
|
|
|
|
|
|
|
@NonNull
|
|
|
|
|
|
|
|
public static SimpleDateFormat fromSkeleton(@NonNull String skeleton,
|
|
|
|
|
|
|
|
@NonNull Locale locale)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SimpleDateFormat df = new SimpleDateFormat(skeleton, locale);
|
|
|
|
|
|
|
|
df.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
|
|
|
|
|
|
return df;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static SimpleDateFormat getBackupDateFormat()
|
|
|
|
@JvmStatic fun fromSkeleton(
|
|
|
|
{
|
|
|
|
skeleton: String,
|
|
|
|
return fromSkeleton("yyyy-MM-dd HHmmss", Locale.US);
|
|
|
|
locale: Locale
|
|
|
|
}
|
|
|
|
): SimpleDateFormat {
|
|
|
|
|
|
|
|
val df = SimpleDateFormat(skeleton, locale)
|
|
|
|
|
|
|
|
df.timeZone = TimeZone.getTimeZone("UTC")
|
|
|
|
|
|
|
|
return df
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JvmStatic fun getBackupDateFormat(): SimpleDateFormat =
|
|
|
|
|
|
|
|
fromSkeleton("yyyy-MM-dd HHmmss", Locale.US)
|
|
|
|
|
|
|
|
|
|
|
|
public static SimpleDateFormat getCSVDateFormat()
|
|
|
|
@JvmStatic fun getCSVDateFormat(): SimpleDateFormat =
|
|
|
|
{
|
|
|
|
fromSkeleton("yyyy-MM-dd", Locale.US)
|
|
|
|
return fromSkeleton("yyyy-MM-dd", Locale.US);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|