Util class (deprecated)
The Util class is deprecated and is provided for backward compatibility only. New applications developed using standard JDBC calls do not need the functionality provided by the Util class.
The Util class is a utility class that contains static methods for converting Java Date objects to Netscape Application Server date/time formats and IBuffer values to string. Like the methods in the Math and System classes in the Java Class Library, the methods in the Util class can be used anywhere regardless of whether an instance of the class exists or not.
You call the methods in the Util class by using the following convention: Util.method. The following example shows how you call toString( ), a method in the Util class, to convert data in a returned IBuffer object to a string value:
String groupbyString;
groupbyString = Util.toString(qry.getGroupBy());
Package
com.kivasoft.util
Methods
dateToDate( )
Converts a Java Date object and returns a string containing the date value in the Netscape Application Server date format.
Syntax
public static String dateToDate(
Date date)
date.
Date object containing the date value to convert. The specified date must be a Java Date object.
Usage
Use dateToDate( ) when working with dates and operations in the Data Access Engine (DAE).
Tip
See the java.util.Date class for additional options for obtaining and formatting date and time values.
Return Value
String representing the date portion of the Date object, or null for failure.
Example 1
Date startDate=new Date(String.valueOf(month)+"/1/"+year);
Date endDate=new Date(String.valueOf(month)+"/"+numDays+"/"+year+"
23:59:59");
log(month+"/"+numDays+"/"+year);
log(startDate.toString()+" "+dateToDate(startDate));
log(endDate.toString()+" "+dateToDate(endDate));
Example 2
// Get and display date portion of current date as a string.
String todaysDate;
todaysDate=dateToDate(new date());
System.out.println("Today, in Netscape Application Server format, is " +
todaysDate + ".");
Related Topics
dateToTime( )
dateToTimeStamp( )
dateToTime( )
Converts a Java Date object and returns a string containing the time value in the Netscape Application Server time format.
Syntax
public static String dateToTime(
Date date)
date.
Date object containing the time value to convert. The specified date must be a Java Date object.
Usage
Use dateToTime( ) when working with time and operations in the Data Access Engine (DAE).
Return Value
String representing the time portion of the Date object, or null for failure.
Tip
See the java.util.Date class for additional options for obtaining and formatting date and time values.
Example 1
Date startDate=new Date(String.valueOf(month)+"/1/"+year);
Date endDate=new Date(String.valueOf(month)+"/"+numDays+"/"+year+"
23:59:59");
log(month+"/"+numDays+"/"+year);
log(startTime.toString()+" "+dateToTime(startDate));
log(endTime.toString()+" "+dateToTime(endDate));
Example 2
// Get and display time portion of current date as a string.
String timeRightNow;
timeRightNow=dateToTime(new date());
System.out.println("Time right now, in Netscape Application Server
format, is " + todaysDate + ".");
Related Topics
dateToDate( )
dateToTimeStamp( )
dateToTimeStamp( )
Converts a Java Date object and returns a string containing the date and time value in the Netscape Application Server time stamp format.
Syntax
public static String dateToTimeStamp(
Date date)
date.
Date object containing the value to convert. The specified date must be a Java Date object.
Usage
Use dateToTimeStamp( ) when working with dates and times, as well as operations in the Data Access Engine (DAE).
Tip
See the java.util.Date class for additional options for obtaining and formatting date and time values.
Return Value
String representing the date and time portions of a date.
Example 1
Date startDate=new Date(String.valueOf(month)+"/1/"+year);
Date endDate=new Date(String.valueOf(month)+"/"+numDays+"/"+year+"
23:59:59");
log(month+"/"+numDays+"/"+year);
log(startTime.toString()+" "+dateToTimeStamp(startDate));
log(endTime.toString()+" "+dateToTimeStamp(endDate));
Example 2
// Get and display time portion of current date as a string.
String dateTimeRightNow;
dateTimeRightNow=dateToTimeStamp(new date());
System.out.println("Date and time right now, in Netscape Application
Server format, is " + dateTimeRightNow + ".");
Related Topics
dateToDate( )
dateToTime( )
toString( )
Converts data in an IBuffer object to a string value.
Syntax
public static String toString(
IBuffer buffer)
buffer.
IBuffer object containing the value to convert.
Usage
Use toString( ) to convert the IBuffer objects returned by the get**( ) methods in the IQuery interface (deprecated) to string values.
Return Value
String representing the data in an IBuffer object.
Related Topics
IBuffer interface (deprecated)
IQuery interface (deprecated)
|