Java Code Examples for java.util.Date.getTimezoneOffset()

The following are Jave code examples for showing how to use getTimezoneOffset() of the java.util.Date class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: unitimes   File: ServerDateTimeFormat.java   Source Code and License Vote up 4 votes
@SuppressWarnings("deprecation")
public static Date toLocalDate(Date serverDate) {
	if (serverDate == null || sServerTimeZone == null) return serverDate;
	return new Date(serverDate.getTime() + 60000 * (serverDate.getTimezoneOffset() - getOffset(serverDate)));
}
 
Example 2
Project: unitimes   File: ServerDateTimeFormat.java   Source Code and License Vote up 4 votes
@SuppressWarnings("deprecation")
public static Date toServerDate(Date localDate) {
	if (localDate == null || sServerTimeZone == null) return localDate;
	return new Date(localDate.getTime() + 60000 * (getOffset(localDate) - localDate.getTimezoneOffset()));
}