public class

DateTimeConverter

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.DateTimeConverter

Class Overview

The DateTimeConverter class will allow the user to change dates/times between GMT, which is what the I-Server returns timestamps in, and the local time zone of the end user. This class is meant to be used by those integrating the MicroStrategy Web Objects API with a Windows-based development environment such as ASP or Visual Basic.

Summary

Constants
String serverPattern The pattern of a date time string from the MicroStrategy Intelligence Server.
Public Constructors
DateTimeConverter()
The constructor of DateTimeConverter is used to obtain an instance of this class, and initializes the locale to the default locale of the machine, the timezone to GMT.
Public Methods
String convert(String iServerNeutralDateTime)
This method will take the locale and timezone indepenent string returned from the Intelligence Server and convert it to the locale and time zone which are set on this DateTimeConverter instance.
static String[] getAvailableTimeZoneIDs()
This method will return the list of available time zone IDs.
int getLocaleID()
Returns the Windows LCID of the locale set on this object.
String getTimeZoneID()
Returns the ID of the time zone which will be used when calling the convert method.
long getTimestamp(String iServerNeutralDateTim)
This method will convert a datetime string to a long million second timestamp
void setLocaleID(int localeID)
Sets the locale of this object by specifying the Windows LCID.
void setTimeZoneID(String timezoneID)
This method sets the ID of the time zone which will be used to convert date/time values when the convert method is called.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String serverPattern

The pattern of a date time string from the MicroStrategy Intelligence Server.

Constant Value: "yyyy-MM-dd HH:mm:ss"

Public Constructors

public DateTimeConverter ()

The constructor of DateTimeConverter is used to obtain an instance of this class, and initializes the locale to the default locale of the machine, the timezone to GMT. These initial values can be changed after obtaining an instance of the object.

Public Methods

public String convert (String iServerNeutralDateTime)

This method will take the locale and timezone indepenent string returned from the Intelligence Server and convert it to the locale and time zone which are set on this DateTimeConverter instance.

Parameters
iServerNeutralDateTime The locale and time zone independent representation of a date/time from the Intelligence Server.
Returns
  • A locale-formatted, time zone adjusted, representation of the string passed to the method.
Throws
WebUtilsException Thrown if the conversion cannot take place.

public static String[] getAvailableTimeZoneIDs ()

This method will return the list of available time zone IDs. The argument passed to setTimeZoneID and the value returned from getTimeZoneID must come from this list.

Returns
  • The list of available time zone IDs.

public int getLocaleID ()

Returns the Windows LCID of the locale set on this object. This will determine the locale that the date/time string will be formatted in after the conversion takes place.

Returns
  • The Windows LCID of the locale currently set on this object.

public String getTimeZoneID ()

Returns the ID of the time zone which will be used when calling the convert method. This value will be one of the values returned from the getAvailableTimeZoneIDs method.

Returns
  • The time zone ID which will be used upon calling convert.

public long getTimestamp (String iServerNeutralDateTim)

This method will convert a datetime string to a long million second timestamp

Returns
  • A timestamp in million seconds

public void setLocaleID (int localeID)

Sets the locale of this object by specifying the Windows LCID. This will determine the locale that the date/time string will be formatted in after the convert method is called

Parameters
localeID The Windows LCID corresponding to the locale that the date should be formatted in.

public void setTimeZoneID (String timezoneID)

This method sets the ID of the time zone which will be used to convert date/time values when the convert method is called. This value must be one of the values returned from the getAvailableTimeZoneIDs method.

Parameters
timezoneID The ID of the time zone to convert to.