Get attribute of mysql type: date, year
322631
public java.util.Date getDate(String attr) {
		return (java.util.Date)attrs.get(attr);
	}
1010422
static function UnixDate($v)
	{

		if (is_numeric(substr($v,0,1)) && ADODB_PHPVER >= 0x4200) return parent::UnixDate($v);

		global $ADODB_mssql_mths,$ADODB_mssql_date_order;

		//Dec 30 2000 12:00AM
		if ($ADODB_mssql_date_order == 'dmy') {
			if (!preg_match( "|^([0-9]{1,2})[-/\. ]+([A-Za-z]{3})[-/\. ]+([0-9]{4})|" ,$v, $rr)) {
				return parent::UnixDate($v);
			}
			if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;

			$theday = $rr[1];
			$themth =  substr(strtoupper($rr[2]),0,3);
		} else {
			if (!preg_match( "|^([A-Za-z]{3})[-/\. ]+([0-9]{1,2})[-/\. ]+([0-9]{4})|" ,$v, $rr)) {
				return parent::UnixDate($v);
			}
			if ($rr[3] <= TIMESTAMP_FIRST_YEAR) return 0;

			$theday = $rr[2];
			$themth = substr(strtoupper($rr[1]),0,3);
		}
		$themth = $ADODB_mssql_mths[$themth];
		if ($themth <= 0) return false;
		// h-m-s-MM-DD-YY
		return  adodb_mktime(0,0,0,$themth,$theday,$rr[3]);
	}
620372
function objectAttributeContent( $contentObjectAttribute )
    {
        $date = new eZDate( );
        $stamp = $contentObjectAttribute->attribute( 'data_int' );
        $date->setTimeStamp(
            eZTimestamp::getLocalTimestampFromUtcTimestamp( $stamp )
        );
        return $date;
    }
373861
public static function dateToSQL($tahun, $bulan, $tanggal, $minTahun = "", $maxTahun = "")
    {
        $tahun   = (int)$tahun;
        $bulan   = (int)$bulan;
        $tanggal = (int)$tanggal;
        if ($tanggal <= 0 || $tanggal > 31) {
            $tanggalX = "01";
        } else if ($tanggal < 10) {
            $tanggalX = "0" . $tanggal;
        } else {
            $tanggalX= $tanggal;
        }
        if ($bulan <= 0 || $bulan > 12) {
            $bulanX = "01";
        } else if ($bulan < 10) {
            $bulanX = "0" . $bulan;
        } else {
            $bulanX = $bulan;
        }
        if ($minTahun != "") {
            if ($tahun >= $minTahun) {
                if ($maxTahun != "") {
                    if ($tahun <= $maxTahun) {
                        $tahunX = $tahun;
                    } else {
                        $tahunX = date("Y");
                    }
                } else {
                    $tahunX = $tahun;
                }
            } else {
                $tahunX = date("Y");
            }
        } else {
            if (strlen($tahun) == 4) {
                $tahunX = $tahun;
            } else {
                $tahunX = date("Y");
            }
        }
        $tanggalSql = $tahunX . "-" . $bulanX . "-" . $tanggalX;

        return $tanggalSql;
    }
5764
protected final String getDate(final Attribute attr) {
        final GetDateVisitor visitor = new GetDateVisitor();
        attr.accept(visitor);
        return visitor.getDate();
    }
561587
function MetaType($t,$len=-1,$fieldobj=false)
	{
		if (is_object($t)) {
			$fieldobj = $t;
			$t = $fieldobj->type;
			$len = $fieldobj->max_length;
		}

		$len = -1; // mysql max_length is not accurate
		switch (strtoupper($t)) {
		case 'R':
		case 'INT':
		case 'INTEGER': return  'I';
		case 'BIT':
		case 'TINYINT': return  'I1';
		case 'SMALLINT': return 'I2';
		case 'BIGINT':  return  'I8';
		case 'SMALLDATETIME': return 'T';
		case 'REAL':
		case 'FLOAT': return 'F';
		default: return parent::MetaType($t,$len,$fieldobj);
		}
	}
914680
protected function _formatDate($field, &$attributes)
    {
        if ($this->timestamps && $field) {

            switch ($this->dateFormat) {
                case 'datetime':
                    $dateFormat = date("Y-m-d H:i:s");
                    break;
                
                case 'unixtime':
                default:
                    $dateFormat = time();
                    break;
            }
            
            $attributes[$field] = $dateFormat;
        }

        return $attributes;
    }
551769
function getData(el, attr, isInt, prefix) {
    if (prefix === undefined) {
      prefix = 'wookmark-';
    }
    var val = el.getAttribute('data-' + prefix + attr);
    if (isInt === true) {
      return parseInt(val, 10);
    }
    return val;
  }
80416
def get_date_field(datetimes, field):
    """"""
    return np.array([getattr(date, field) for date in datetimes])
794116
public static String getTypeString(XAttribute attribute) {
		if (attribute instanceof XAttributeList) {
			return "LIST";
		} else if (attribute instanceof XAttributeContainer) {
			return "CONTAINER";
		} else if (attribute instanceof XAttributeLiteral) {
			return "LITERAL";
		} else if (attribute instanceof XAttributeBoolean) {
			return "BOOLEAN";
		} else if (attribute instanceof XAttributeContinuous) {
			return "CONTINUOUS";
		} else if (attribute instanceof XAttributeDiscrete) {
			return "DISCRETE";
		} else if (attribute instanceof XAttributeTimestamp) {
			return "TIMESTAMP";
		} else if (attribute instanceof XAttributeID) {
			return "ID";
		} else {
			throw new AssertionError("Unexpected attribute type!");
		}
	}
1112368
public static function makeUpdateSQL()
    {
        $tableName = self::getTableName();
        $setClause = "";
        $whereClause = "";
        $keysCount = count(self::$fields);
        $iterations = 1;

        foreach(self::$fields as $key => $val)
        {
            if($key == "id") {
                $whereClause = " WHERE id = ".$val;
            }
            else if($key != "result") {
                $setClause = $setClause.$key." = '".$val."'";

                if($keysCount > 2 && $iterations < $keysCount) {
                    $setClause = $setClause.", ";
                }
            }
            $iterations++;
        }

        $sql = "UPDATE ".$tableName." SET ".$setClause.$whereClause;

        return $sql;
    }
1201157
function normalizeAttributes(attrs, strip) {

            // map for converting SQL types to Sequelize DataTypes.
            var map = {
                    TINYINT: 'BOOLEAN',
                    DATETIME: 'DATE',
                    TIMESTAMP: 'DATE',
                    'VARCHAR BINARY': 'STRING.BINARY',
                    'TINYBLOB': 'BLOB',
                    VARCHAR: 'STRING[LEN]',
                    'INTEGER UNSIGNED ZEORFILL': 'INTEGER[LEN].UNSIGNED.ZEROFILL',
                    'INTEGER UNSIGNED': 'INTEGER[LEN].UNSIGNED',
                    'INTEGER ZEROFILL': 'INTEGER[LEN].ZEROFILL',
                    INTEGER: 'INTEGER[LEN]',
                    'FLOAT UNSIGNED ZEORFILL': 'FLOAT[LEN].UNSIGNED.ZEROFILL',
                    'FLOAT ZEROFILL': 'FLOAT[LEN].ZEROFILL',
                    'FLOAT UNSIGNED': 'FLOAT[LEN].UNSIGNED',
                    FLOAT: 'FLOAT[LEN]',
                    'BIGINT UNSIGNED ZEORFILL': 'BIGINT[LEN].UNSIGNED.ZEROFILL',
                    'BIGINT ZEROFILL': 'BIGINT[LEN].ZEROFILL',
                    'BIGINT UNSIGNED': 'BIGINT[LEN].UNSIGNED',
                    BIGINT: 'BIGINT[LEN]',
                    DECIMAL: 'DECIMAL[LEN]',
                    ENUM: 'ENUM'
                },
                mapKeys = Object.keys(map);

            strip = strip || [];
            strip.push('Model');

            // convert and format to Sequelize Model Type.
            function getType(type, len, name) {

                if(!type) return undefined;
                type = type.split('(')[0];

                if(map[type]){
                    var tmp = map[type];
                    if(len && !_.contains([255, 11], len)) len = '(' + len + ')';
                    else len = '';
                    type = tmp.replace('[LEN]', len);
                }

                return type;
            }

            // iterate properties.
            for(var prop in attrs) {

                if(attrs.hasOwnProperty(prop)){

                    var attr = attrs[prop],
                        type = attr.type,
                        prec = type._precision && type._scale ? type._precision + ',' + type._scale : false,
                        len = prec ? prec : type._length || false;

                    // strip properties.
                    strip.forEach(function (s) {
                        if(attr[s]) delete attr[s];
                    });

                    if(attr.validate && attr.validate._checkEnum)
                        type = 'ENUM';

                    if(!type._binary && type._length)
                        type = 'VARCHAR';

                    if(type._binary)
                        type = 'VARCHAR BINARY';

                    if(_.contains(['INTEGER', 'FLOAT', 'BIGINT'], type._typeName)){
                        var tmp = '';
                        tmp = type._unsigned ? tmp += ' UNSIGNED' : tmp;
                        tmp = type._zerofill ? tmp += ' ZEROFILL' : tmp;
                        type = type._typeName + tmp;

                    }

                    if(_.isObject(type))
                        type = type._typeName;

                    attrs[prop].type = getType(type, len, attr.fieldName);

                }

            }

            return attrs;
        }
341790
public function getTimestampAttribute()
    {
        if (! array_key_exists('timestamp', $this->attributes)) {
            return Carbon::now();
        }

        return Carbon::parse($this->attributes['timestamp']);
    }
1162001
def typecast_attributes
    @attributes.each_pair do |name,value|
      # skip primary key columns
      # ajay Singh --> skip the loop if attribute is null (!name.present?)
      next if (name == "id") or (!name.present?)
      attr_type = attr_type_for(name)
      
      # empty attributes should stay empty (e.g. an empty int field shouldn't be typecast as 0)
      if [:datetime, :datetimecombo, :int].include? attr_type && (value.nil? || value == '')
        @attributes[name] = nil
        next
      end
      
      case attr_type
      when :bool
        @attributes[name] = (value == "1")
      when :datetime, :datetimecombo
        begin
          @attributes[name] = DateTime.parse(value)
        rescue
          @attributes[name] = value
        end
      when :int
        @attributes[name] = value.to_i
      end
    end
    @attributes
  end
417254
def get_type_len(self):
        """"""
        # Check types and set type/len
        self.get_sql()
        return self.type, self.len, self.len_decimal
1009822
def date_field(attribute, options = {})
      value = object.send(attribute)
      data = { datepicker: "" }
      data[:startdate] = I18n.localize(value, format: :decidim_short) if value.present? && value.is_a?(Date)
      datepicker_format = ruby_format_to_datepicker(I18n.t("date.formats.decidim_short"))
      data[:"date-format"] = datepicker_format

      template = text_field(
        attribute,
        options.merge(data: data)
      )
      help_text = I18n.t("decidim.datepicker.help_text", datepicker_format: datepicker_format)
      template += error_and_help_text(attribute, options.merge(help_text: help_text))
      template.html_safe
    end
767658
private function getDateFromSchemaOrg(): ?\DateTime {
        $dt = null;

        // Check for HTML tags (<meta>, <time>, etc.)
        $nodes = $this->article()->getRawDoc()->find('*[itemprop="datePublished"]');

        /* @var $node Element */
        foreach ($nodes as $node) {
            try {
                if ($node->hasAttribute('datetime')) {
                    $dt = new \DateTime($node->getAttribute('datetime'));
                    break;
                }
                if ($node->hasAttribute('content')) {
                    $dt = new \DateTime($node->getAttribute('content'));
                    break;
                }
            }
            catch (\Exception $e) {
                // Do nothing here in case the node has unrecognizable date information.
            }
        }

        if (!is_null($dt)) {
            return $dt;
        }

        // Check for JSON-LD
        $nodes = $this->article()->getRawDoc()->find('script[type="application/ld+json"]');

        /* @var $node Element */
        foreach ($nodes as $node) {
            try {
                $json = json_decode($node->text());
                if (isset($json->datePublished)) {
                    $date = is_array($json->datePublished)
                        ? array_shift($json->datePublished)
                        : $json->datePublished;

                    $dt = new \DateTime($date);
                    break;
                }
            }
            catch (\Exception $e) {
                // Do nothing here in case the node has unrecognizable date information.
            }
        }

        return $dt;
    }