public class M18NUtil
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
M18NUtil()
Creates a new instance of M18NUtil using jvm default locale and timezone
|
M18NUtil(com.labvantage.sapphire.services.ConnectionInfo connectionInfo)
Creates a new instance of M18NUtil using the connectionInfo specified
|
M18NUtil(java.io.File rakFile,
com.labvantage.sapphire.services.ConnectionInfo connectionInfo)
Creates a new instance of M18NUtil using the connectionInfo specified
|
M18NUtil(java.util.Locale locale,
java.util.TimeZone timezone)
Creates a new instance of M18NUtil using the locale and time
|
M18NUtil(PageContext pageContext)
Creates a new instance of M18NUtil using the pageContext specified
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(java.math.BigDecimal bigDecimal)
Formats a BigDecimal into a local-sensitive String
|
java.lang.String |
format(java.math.BigDecimal bigDecimal,
boolean group)
Formats a BigDecimal into a local-sensitive String
|
java.lang.String |
format(java.math.BigDecimal bigDecimal,
boolean group,
boolean stripTrailingZeros)
Formats a BigDecimal into a local-sensitive String
|
java.lang.String |
format(java.util.Calendar calendar)
Formats a Calender into date time string according to user locale and timezone
|
java.lang.String |
format(java.util.Calendar calendar,
boolean userTimeZoneSensitive)
Formats a Calender into date time string according to user locale and with or without user timezone adjustment
|
java.lang.String |
formatDateOnly(java.util.Calendar calendar)
Formats a Calender into date only string according to user locale and timezone
|
java.lang.String |
formatDateOnly(java.util.Calendar calendar,
boolean userTimeZoneSensitive)
Formats a Calender into date only string according to user locale and with or without user timezone adjustment
|
java.time.format.DateTimeFormatter |
getDateFormatter(java.time.ZoneId displayZone) |
java.time.format.DateTimeFormatter |
getDateTimeFormatter(java.time.ZoneId displayZone) |
java.text.DateFormat |
getDefaultDateFormat() |
java.text.DateFormat |
getDefaultDateFormat(boolean userTimeZoneSensitive) |
java.text.DateFormat |
getDefaultDateOnlyFormat() |
java.text.DateFormat |
getDefaultDateOnlyFormat(boolean userTimeZoneSensitive) |
java.util.Locale |
getLocale() |
java.util.Locale |
getLocaleForDateTime() |
java.util.Calendar |
getNowCalendar() |
java.text.DateFormat |
getSysQueryDateFormat() |
java.time.format.DateTimeFormatter |
getTimeFormatter(java.time.ZoneId displayZone) |
java.util.TimeZone |
getTimezone()
Return the time zone used to format and parse date time string by this object in user's time zone
|
boolean |
isRelDate(java.lang.String date) |
boolean |
isRelDate(java.lang.String date,
boolean dateonly) |
java.math.BigDecimal |
parseBigDecimal(java.lang.String value)
Parses a locale-sensitive String into a BigDecimal
|
java.util.Calendar |
parseCalendar(java.lang.String datetime)
Parse a date time string into a Calender object assuming the user'local and timezone
|
java.util.Calendar |
parseCalendar(java.lang.String datetime,
boolean userTimeZoneSensitive)
Parse a date time string into a Calender object assuming the user'local and with or without user timezone adjustment String
|
java.sql.Timestamp |
parseTimestamp(java.lang.String datetime) |
java.sql.Timestamp |
parseTimestamp(java.lang.String datetime,
boolean userTimeZoneSensitive) |
void |
setTimeZone(java.util.TimeZone timeZone)
Set the user Time Zone.
|
public M18NUtil()
public M18NUtil(com.labvantage.sapphire.services.ConnectionInfo connectionInfo)
connectionInfo - The connectionInfo that contains user locale and timezone info etc.public M18NUtil(java.io.File rakFile,
com.labvantage.sapphire.services.ConnectionInfo connectionInfo)
connectionInfo - The connectionInfo that contains user locale and timezone info etc.rakFile - The rak file.public M18NUtil(PageContext pageContext)
pageContext - The pageContext from inside a jsp page.public M18NUtil(java.util.Locale locale,
java.util.TimeZone timezone)
locale - The locale to use.timezone - The time zone to use.public java.util.Calendar parseCalendar(java.lang.String datetime)
datetime - The datetime string to parsepublic java.util.Calendar parseCalendar(java.lang.String datetime,
boolean userTimeZoneSensitive)
datetime - The datetime string to parseuserTimeZoneSensitive - Whether parsing according to user's timezonepublic java.lang.String format(java.util.Calendar calendar)
calendar - The Calendar value to formatpublic java.lang.String formatDateOnly(java.util.Calendar calendar)
calendar - The Calendar value to formatpublic java.lang.String format(java.util.Calendar calendar,
boolean userTimeZoneSensitive)
calendar - The Calendar value to formatuserTimeZoneSensitive - - whether format to user's time zonepublic java.lang.String formatDateOnly(java.util.Calendar calendar,
boolean userTimeZoneSensitive)
calendar - The Calendar value to formatuserTimeZoneSensitive - - whether format to user's time zonepublic java.time.format.DateTimeFormatter getDateTimeFormatter(java.time.ZoneId displayZone)
public java.time.format.DateTimeFormatter getDateFormatter(java.time.ZoneId displayZone)
public java.time.format.DateTimeFormatter getTimeFormatter(java.time.ZoneId displayZone)
public java.text.DateFormat getDefaultDateFormat()
public java.text.DateFormat getDefaultDateOnlyFormat()
public java.text.DateFormat getSysQueryDateFormat()
public java.text.DateFormat getDefaultDateFormat(boolean userTimeZoneSensitive)
userTimeZoneSensitive - - whether the returned DateFormat is in user's timezonepublic java.text.DateFormat getDefaultDateOnlyFormat(boolean userTimeZoneSensitive)
userTimeZoneSensitive - - whether the returned DateFormat is in user's timezonepublic java.util.Calendar getNowCalendar()
public java.lang.String format(java.math.BigDecimal bigDecimal)
bigDecimal - The BigDecimal value to formatpublic java.lang.String format(java.math.BigDecimal bigDecimal,
boolean group,
boolean stripTrailingZeros)
bigDecimal - The BigDecimal value to formatpublic java.lang.String format(java.math.BigDecimal bigDecimal,
boolean group)
bigDecimal - The BigDecimal value to formatgroup - Whether to show grouping or notpublic java.math.BigDecimal parseBigDecimal(java.lang.String value)
value - the String valuepublic java.util.Locale getLocale()
public java.util.TimeZone getTimezone()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone - public boolean isRelDate(java.lang.String date)
public boolean isRelDate(java.lang.String date,
boolean dateonly)
public java.sql.Timestamp parseTimestamp(java.lang.String datetime,
boolean userTimeZoneSensitive)
public java.sql.Timestamp parseTimestamp(java.lang.String datetime)
public java.util.Locale getLocaleForDateTime()