Safe get elemnent date.

        Get element as datetime.date or None,
        :param root:
            Lxml element.
        :param path:
            String path (i.e. 'Items.Item.Offers.Offer').
        :return:
            datetime.date or None.
964200
def _safe_get_element_date(self, path, root=None):
        
        value = self._safe_get_element_text(path=path, root=root)
        if value is not None:
            try:
                value = dateutil.parser.parse(value)
                if value:
                    value = value.date()
            except ValueError:
                value = None

        return value
371361
def GetDate(self):
    
    normalized_timestamp = self._GetNormalizedTimestamp()
    if normalized_timestamp is None:
      return None, None, None

    number_of_days, _, _, _ = self._GetTimeValues(normalized_timestamp)

    try:
      return self._GetDateValuesWithEpoch(
          number_of_days, self._EPOCH_NORMALIZED_TIME)

    except ValueError:
      return None, None, None
498137
def _grab_xpath(root, xpath, converter=lambda x: x):
    
    elements = root.xpath(xpath)
    if elements:
        return converter(str(elements[0]))
    else:
        return None
1300074
def _element_find_from_root(
        root,  # type: ET.Element
        element_path  # type: Text
):
    # type: (...) -> Optional[ET.Element]
    
    element = None

    element_names = element_path.split('/')
    if element_names[0] == root.tag:
        if len(element_names) > 1:
            element = root.find('/'.join(element_names[1:]))
        else:
            element = root

    return element
358390
def root (path, root):
    
    if os.path.isabs (path):
        return path
    else:
        return os.path.join (root, path)
373617
def get_date(self, p_tag):
        
        string = self.tag_value(p_tag)
        result = None

        try:
            result = date_string_to_date(string) if string else None
        except ValueError:
            pass

        return result
886006
def getDateReceived(self):
        
        request = self.getRequest()
        if request:
            ar_date = request.getDateReceived()
            if ar_date and self.created() > ar_date:
                return self.created()
            return ar_date
        return None
86026
def getDateTimeFromGet(request,key):
    '''
    
    '''
    if request.GET.get(key,''):
        try:
            return ensure_timezone(datetime.strptime(unquote(request.GET.get(key,'')),'%Y-%m-%d'))
        except (ValueError, TypeError):
            pass
    return None
718181
function getDate(node) {
    var text = getText(node);
    if (!text) {
        return undefined;
    }
    if (text.indexOf(':') > 0) {
        return new Date(text);
    }
    var bytes = new DataView(ByteUtils.arrayToBuffer(ByteUtils.base64ToBytes(text)));
    var secondsFrom00 = new Int64(bytes.getUint32(0, true), bytes.getUint32(4, true)).value;
    var diff = (secondsFrom00 - EpochSeconds) * 1000;
    return new Date(diff);
}
799388
def parse_date(value):
    
    if not value:
        return None

    if isinstance(value, datetime.date):
        return value

    return parse_datetime(value).date()
454122
def Date(value):
    """"""
    from datetime import datetime
    try:
        return datetime(*reversed([int(val) for val in value.split('/')]))
    except Exception as err:
        raise argparse.ArgumentTypeError("invalid date '%s'" % value)
1228835
def get_access_datetime(filepath):
    
    import tzlocal
    tz = tzlocal.get_localzone()
    mtime = datetime.fromtimestamp(os.path.getatime(filepath))
    return mtime.replace(tzinfo=tz)
1279599
def getDate(self):
        ""
        date = self.headers.get('date')
        if date:
            date = self.convertTimeString(date)
        return date
1276051
def root(path: Union[str, pathlib.Path]) -> _Root:
    
    return _Root.from_path(_normalise_path(path))
1281138
def date(self,local=False):
        
        return Date(self.get(local).date(),self.local_tz)
284005
def _update_dates(self, xpath_root=None, **update_props):
        

        tree_to_update = update_props['tree_to_update']
        prop = update_props['prop']
        values = (update_props['values'] or {}).get(DATE_VALUES) or u''
        xpaths = self._data_structures[prop]

        if not self.dates:
            date_xpaths = xpath_root
        elif self.dates[DATE_TYPE] != DATE_TYPE_RANGE:
            date_xpaths = xpaths.get(self.dates[DATE_TYPE], u'')
        else:
            date_xpaths = [
                xpaths[DATE_TYPE_RANGE_BEGIN],
                xpaths[DATE_TYPE_RANGE_END]
            ]

        if xpath_root:
            remove_element(tree_to_update, xpath_root)

        return update_property(tree_to_update, xpath_root, date_xpaths, prop, values)
21240
function getDatePos(date, month, notValue = null) {
	const monthPos = (date.month === month.date.month && 'current') ||
		(date.month === month.nextMonth.date.month && 'next') ||
		(date.month === month.previousMonth.date.month && 'prev');
		
	switch (monthPos) {
		case 'current':
			return calculateDatePos(month.startDayOfMonth, date.day);
		case 'prev':
			return calculateDatePosinPrev(
				month.startDayOfMonth,
				month.previousMonth.daysCount,
				date.day
			);
		case 'next':
			const posNext = calculateDatePosinNext(
				month.startDayOfMonth,
				month.daysCount,
				date.day
			);

			return posNext;

		default:
			return notValue;
	}
}