All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.voximplant.apiclient.util.TimestampSerializer Maven / Gradle / Ivy

Go to download

Voximplant Java API client library. Voximplant is a cloud communications platform for business and developers

There is a newer version: 1.11.0
Show newest version
package com.voximplant.apiclient.util;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;

public class TimestampSerializer implements ValueSerializer {
    public String serialize(Date d) {
        Calendar calendar = GregorianCalendar.getInstance(TimeZone.getTimeZone("Etc/UTC"));
        calendar.setTime(d);
        return String.format("%04d-%02d-%02d %02d:%02d:%02d", calendar.get(Calendar.YEAR),
            calendar.get(Calendar.MONTH)+1, calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY),
            calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy