![JAR search and dependency download from the Maven repository](/logo.png)
eu.future.earth.gwt.client.DateTimeFormatNoTimeZone Maven / Gradle / Ivy
The newest version!
package eu.future.earth.gwt.client;
import java.util.Date;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import eu.future.earth.client.date.DateFunctions;
import eu.future.earth.client.date.DateNoTimeZone;
public class DateTimeFormatNoTimeZone {
DateTimeFormat format;
public DateTimeFormatNoTimeZone(String predef) {
format = DateTimeFormat.getFormat(predef);
}
public static DateTimeFormatNoTimeZone getFormat(String predef) {
return new DateTimeFormatNoTimeZone(predef);
}
public String format(DateNoTimeZone value) {
return format.format(value.getJavaDate());
}
public String format(Date value) {
return format.format(value);
}
public DateNoTimeZone parse(String value) throws IllegalArgumentException {
return new DateNoTimeZone(format.parse(value));
}
public static DateTimeFormatNoTimeZone getFormatterDateShortWithFullYear() {
DateTimeFormatNoTimeZone date = DateTimeFormatNoTimeZone.getFormat(getDateShortPatternWithFullYear());
return date;
}
public static DateTimeFormatNoTimeZone getFormatterFullDayAndDayMonth() {
DateTimeFormatNoTimeZone date = DateTimeFormatNoTimeZone.getFormat("EEEE, " + getMontDayPattern());
return date;
}
public static DateTimeFormatNoTimeZone getFormatterDayOfWeekAndFullDate() {
DateTimeFormatNoTimeZone date = DateTimeFormatNoTimeZone.getFormat("EEEE, " + getDateShortPatternWithFullYear());
return date;
}
public static String getDateShortPatternWithFullYear() {
return DateFunctions.fixYearsToFour(getPatternDateYear());
}
public static String getDateShortPatternWithAllFull() {
return DateFunctions.fixYearsToFourAndFull(getPatternDateYear());
}
public static String getPatternDateYear() {
String defPattern = DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).getPattern();
return defPattern;
}
public static String getMontDayPattern() {
return DateFunctions.removeYear(getPatternDateYear());
}
public static DateTimeFormatNoTimeZone getFormatterDateTime() {
DateTimeFormatNoTimeZone date = DateTimeFormatNoTimeZone.getFormat(getPatternDateTime());
return date;
}
public static String getPatternDateTime() {
return getDateShortPatternWithFullYear() + " HH:mm";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy