SimpleDateFormat( "yyyy-MM-dd", Locale.CHINESE );
/**
* Creates a new DateUtil object
*/
public DateUtil()
{
}
* Creates a new DateUtil object
*/
public DateUtil()
{
}
/**
* Returns the date of the day in form of a String
*
* @return The Date of the day in a "yyyy-MM-dd" format
*/
public static String getCurrentDateString()
{
return _formatter.format( new java.util.Date() );
}
* Returns the date of the day in form of a String
*
* @return The Date of the day in a "yyyy-MM-dd" format
*/
public static String getCurrentDateString()
{
return _formatter.format( new java.util.Date() );
}
/**
* Converts a String date in a "yyyy-MM-dd" format in a java.sql.Date type date
*
* @param strDate The String Date to convert, in a date in the "yyyy-MM-dd" format
* @return The date in form of a java.sql.Date tyep date
*/
public static java.sql.Date getDateSql( String strDate )
{
ParsePosition pos = new ParsePosition( 0 );
java.util.Date date = _formatter.parse( strDate, pos );
if( date != null )
{
return new java.sql.Date( date.getTime() );
}
return null;
}
* Converts a String date in a "yyyy-MM-dd" format in a java.sql.Date type date
*
* @param strDate The String Date to convert, in a date in the "yyyy-MM-dd" format
* @return The date in form of a java.sql.Date tyep date
*/
public static java.sql.Date getDateSql( String strDate )
{
ParsePosition pos = new ParsePosition( 0 );
java.util.Date date = _formatter.parse( strDate, pos );
if( date != null )
{
return new java.sql.Date( date.getTime() );
}
return null;
}
/**
* Converts a java.sql.Date type date in a String date with a "yyyy-MM-dd" format
*
* @param date java.sql.Date date to convert
* @return strDate The date converted to String in a "yyyy-MM-dd" format or an empty String if
* the date is null
*/
public static String getDateString( java.sql.Date date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
* Converts a java.sql.Date type date in a String date with a "yyyy-MM-dd" format
*
* @param date java.sql.Date date to convert
* @return strDate The date converted to String in a "yyyy-MM-dd" format or an empty String if
* the date is null
*/
public static String getDateString( java.sql.Date date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
/**
* Converts une java.sql.Timestamp date in a String date in a "yyyy-MM-dd" format
*
* @param date java.sql.Timestamp date to convert
* @return strDate The String date in a "yyyy-MM-dd" format or the emmpty String if the date is
* null
*/
public static String getDateString( java.sql.Timestamp date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
* Converts une java.sql.Timestamp date in a String date in a "yyyy-MM-dd" format
*
* @param date java.sql.Timestamp date to convert
* @return strDate The String date in a "yyyy-MM-dd" format or the emmpty String if the date is
* null
*/
public static String getDateString( java.sql.Timestamp date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
/**
* Converts a java.util.Date date in a String date in a "yyyy-MM-dd" format
*
* @param date java.util.Date date to convert
* @return strDate A String date in a "yyyy-MM-dd" format or an empty String if the date is null
*/
public static String getDateString( java.util.Date date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
}
* Converts a java.util.Date date in a String date in a "yyyy-MM-dd" format
*
* @param date java.util.Date date to convert
* @return strDate A String date in a "yyyy-MM-dd" format or an empty String if the date is null
*/
public static String getDateString( java.util.Date date )
{
if( date != null )
{
StringBuffer strDate = new StringBuffer();
_formatter.format( date, strDate, new FieldPosition( 0 ) );
return strDate.toString();
}
return "";
}
}