Codota Logo
Value.getDate
Code IndexAdd Codota to your IDE (free)

How to use
getDate
method
in
org.pentaho.di.compatibility.Value

Best Java code snippets using org.pentaho.di.compatibility.Value.getDate (Showing top 19 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: pentaho/pentaho-kettle

/**
 * Check whether this value is equal to the Date supplied.
 *
 * @param date
 *          The Date to check for equality
 * @return true if the Date representation of the value is equal to date.
 */
public boolean isEqualTo( Date date ) {
 return getDate() == date;
}
origin: pentaho/pentaho-kettle

/**
 * Search for a value, if it doesn't occur in the row, return the default value.
 *
 * @param valuename
 *          The valuename to look for
 * @param def
 *          The default value to return
 * @return The Date representation of the value found or the default
 */
public Date getDate( String valuename, Date def ) {
 Value v = searchValue( valuename );
 if ( v == null ) {
  return def;
 }
 return v.getDate();
}
origin: pentaho/pentaho-kettle

public Value last_day() throws KettleValueException {
 if ( getType() == VALUE_TYPE_DATE ) {
  Calendar cal = Calendar.getInstance();
  cal.setTime( getDate() );
  int last_day = cal.getActualMaximum( Calendar.DAY_OF_MONTH );
  cal.set( Calendar.DAY_OF_MONTH, last_day );
  setValue( cal.getTime() );
 } else {
  throw new KettleValueException( "Function last_day only works on a date" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value first_day() throws KettleValueException {
 if ( getType() == VALUE_TYPE_DATE ) {
  Calendar cal = Calendar.getInstance();
  cal.setTime( getDate() );
  cal.set( Calendar.DAY_OF_MONTH, 1 );
  setValue( cal.getTime() );
 } else {
  throw new KettleValueException( "Function first_day only works on a date" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

public Value add_months( int months ) throws KettleValueException {
 if ( getType() == VALUE_TYPE_DATE ) {
  if ( !isNull() && getDate() != null ) {
   Calendar cal = Calendar.getInstance();
   cal.setTime( getDate() );
   int year = cal.get( Calendar.YEAR );
   int month = cal.get( Calendar.MONTH );
   int day = cal.get( Calendar.DAY_OF_MONTH );
   month += months;
   int newyear = year + (int) Math.floor( month / 12 );
   int newmonth = month % 12;
   cal.set( newyear, newmonth, 1 );
   int newday = cal.getActualMaximum( Calendar.DAY_OF_MONTH );
   if ( newday < day ) {
    cal.set( Calendar.DAY_OF_MONTH, newday );
   } else {
    cal.set( Calendar.DAY_OF_MONTH, day );
   }
   setValue( cal.getTime() );
  }
 } else {
  throw new KettleValueException( "Function add_months only works on a date!" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

/**
 * Add a number of days to a Date value.
 *
 * @param days
 *          The number of days to add to the current date value
 * @return The resulting value
 * @throws KettleValueException
 */
public Value add_days( long days ) throws KettleValueException {
 if ( getType() == VALUE_TYPE_DATE ) {
  if ( !isNull() && getDate() != null ) {
   Calendar cal = Calendar.getInstance();
   cal.setTime( getDate() );
   cal.add( Calendar.DAY_OF_YEAR, (int) days );
   setValue( cal.getTime() );
  }
 } else {
  throw new KettleValueException( "Function add_days only works on a date!" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

 return v.getDate();
} catch ( Exception e2 ) {
 try {
origin: pentaho/pentaho-kettle

public Value trunc() throws KettleValueException {
 if ( isNull() ) {
  return this; // don't do anything, leave it at NULL!
 }
 if ( isInteger() ) {
  // Nothing
  return this;
 }
 if ( isBigNumber() ) {
  getBigNumber().setScale( 0, BigDecimal.ROUND_FLOOR );
 } else if ( isNumber() ) {
  setValue( Math.floor( getNumber() ) );
 } else if ( isDate() ) {
  Calendar cal = Calendar.getInstance();
  cal.setTime( getDate() );
  cal.set( Calendar.MILLISECOND, 0 );
  cal.set( Calendar.SECOND, 0 );
  cal.set( Calendar.MINUTE, 0 );
  cal.set( Calendar.HOUR_OF_DAY, 0 );
  setValue( cal.getTime() );
 } else {
  throw new KettleValueException( "Function TRUNC only works on numbers and dates" );
 }
 return this;
}
origin: pentaho/pentaho-kettle

dos.writeBoolean( getDate() != null );
if ( getDate() != null ) {
 dos.writeLong( getDate().getTime() );
origin: pentaho/pentaho-kettle

dos.writeBoolean( getDate() != null );
if ( getDate() != null ) {
 dos.writeLong( getDate().getTime() );
origin: pentaho/pentaho-kettle

} else if ( isDate() ) {
 Calendar cal = Calendar.getInstance();
 cal.setTime( getDate() );
origin: pentaho/pentaho-kettle

 break;
case VALUE_TYPE_DATE:
 if ( getDate() != null ) {
  hash ^= getDate().hashCode();
origin: pentaho/pentaho-kettle

public Value dat2str( String arg0, String arg1 ) throws KettleValueException {
 if ( isNull() ) {
  setType( VALUE_TYPE_STRING );
 } else {
  if ( getType() == VALUE_TYPE_DATE ) {
   SimpleDateFormat df = new SimpleDateFormat();
   DateFormatSymbols dfs = new DateFormatSymbols();
   if ( arg1 != null ) {
    dfs.setLocalPatternChars( arg1 );
   }
   if ( arg0 != null ) {
    df.applyPattern( arg0 );
   }
   try {
    setValue( df.format( getDate() ) );
   } catch ( Exception e ) {
    setType( VALUE_TYPE_STRING );
    setNull();
    throw new KettleValueException( "TO_CHAR Couldn't convert Date to String " + e.toString() );
   }
  } else {
   throw new KettleValueException( "Function DAT2STR only works on a date" );
  }
 }
 return this;
}
origin: pentaho/pentaho-kettle

Date dat = v.getDate();
if ( dat != null ) {
 dbl = dat.getTime();
origin: pentaho/pentaho-kettle

Date dat = v.getDate();
if ( dat != null ) {
 dbl = dat.getTime();
origin: pentaho/pentaho-kettle

 isNull()
  || ( isString() && ( getString() == null || getString().length() == 0 ) )
  || ( isDate() && getDate() == null ) || ( isBigNumber() && getBigNumber() == null );
boolean n2 =
 v.isNull()
  || ( v.isString() && ( v.getString() == null || v.getString().length() == 0 ) )
  || ( v.isDate() && v.getDate() == null ) || ( v.isBigNumber() && v.getBigNumber() == null );
origin: pentaho/pentaho-kettle

/**
 * Convert this Value from type String to another type
 *
 * @param newtype
 *          The Value type to convert to.
 */
public void convertString( int newtype ) throws KettleValueException {
 switch ( newtype ) {
  case VALUE_TYPE_STRING:
   break;
  case VALUE_TYPE_NUMBER:
   setValue( getNumber() );
   break;
  case VALUE_TYPE_DATE:
   setValue( getDate() );
   break;
  case VALUE_TYPE_BOOLEAN:
   setValue( getBoolean() );
   break;
  case VALUE_TYPE_INTEGER:
   setValue( getInteger() );
   break;
  case VALUE_TYPE_BIGNUMBER:
   setValue( getBigNumber() );
   break;
  default:
   throw new KettleValueException( "Please specify the type to convert to from String type." );
 }
}
origin: pentaho/pentaho-kettle

 return value.getInteger();
case ValueMetaInterface.TYPE_DATE:
 return value.getDate();
case ValueMetaInterface.TYPE_BOOLEAN:
 return value.getBoolean();
origin: pentaho/pentaho-kettle

if ( getDate() == null ) {
 setValue( other.getDate() );
org.pentaho.di.compatibilityValuegetDate

Javadoc

Get the Date of this Value. If the Value is not of type DATE, a conversion is done first.

Popular methods of Value

  • setValue
    Sets the Value to a byte array
  • <init>
    Construct a new Value and read the data from XML
  • getBigNumber
    Get the BigDecimal number of this Value. If the value is not of type BIG_NUMBER, a conversion is don
  • getInteger
    Get the long integer representation of this value. If the Value is not of type INTEGER, it will be c
  • getNumber
    Get the double precision floating point number of this Value. If the value is not of type NUMBER, a
  • getString
    Get the String text representing this value. If the value is not of type STRING, a conversion if don
  • isNull
    Checks wheter or not a value is null.
  • setLength
    Sets the length and the precision of the Number, Integer or String to the specified length & precisi
  • setName
    Sets the name of a Value
  • setNull
    Sets or unsets a value to null, no type is being changed.
  • setType
    Set the type of this Value
  • toString
    a String text representation of this Value, optionally padded to the specified length
  • setType,
  • toString,
  • atan2,
  • clearValue,
  • compare,
  • convertString,
  • convertTo,
  • dat2str,
  • divide

Popular in Java

  • Making http post requests using okhttp
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • getSystemService (Context)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now