py_date.timetuple()[7]
767805
function(date) {
        var dateNoTime = new Date(
            date.getFullYear(), date.getMonth(), date.getDate());
        return Math.ceil(
            (dateNoTime - new Date(date.getFullYear(), 0, 1))
            / dateutil.ONE_DAY) + 1;
    }
351862
def merge_datetime(date, time='', date_format='%d/%m/%Y', time_format='%H:%M'):
    """"""
    day = datetime.strptime(date, date_format)
    if time:
        time = datetime.strptime(time, time_format)
        time = datetime.time(time)
        day = datetime.date(day)
        day = datetime.combine(day, time)
    return day
1255577
def datetime2unix(T):
    
    T = atleast_1d(T)

    ut1_unix = empty(T.shape, dtype=float)
    for i, t in enumerate(T):
        if isinstance(t, (datetime, datetime64)):
            pass
        elif isinstance(t, str):
            try:
                ut1_unix[i] = float(t)  # it was ut1_unix in a string
                continue
            except ValueError:
                t = parse(t)  # datetime in a string
        elif isinstance(t, (float, int)):  # assuming ALL are ut1_unix already
            return T
        else:
            raise TypeError('I only accept datetime or parseable date string')

        # ut1 seconds since unix epoch, need [] for error case
        ut1_unix[i] = forceutc(t).timestamp()

    return ut1_unix
997970
def dateTime(arg):
  
  l = len(arg)
  if l is 1:
    dt = arg[0]
    typed = type(dt)
    if typed is datetime.datetime:
      return dt
    if typed in (tuple, list) and len(dt) in [5, 6, 7]:
      return datetime.datetime(*dt)
  if l is 2:
    date = time = None
    typeArg0 = type(arg[0])
    typeArg1 = type(arg[1])
    if typeArg0 in STR_TYPES:
      return datetime.datetime.strptime(arg[0], arg[1])
    if typeArg0 is datetime.date:
      d = arg[0]
      date = [d.year, d.month, d.day]
    if typeArg0 in (tuple, list):
      date = arg[0]
    if typeArg1 is datetime.time:
      t = arg[1]
      time = [t.hour, t.minute, t.second, t.microsecond]
    if typeArg1 in (tuple, list):
      time = arg[1]
    return datetime.datetime(*date + time)
674751
def prettydate(date):
    now = datetime.now(timezone.utc)
    
    diff = now - date
    # Show the timestamp rather than the relative timeframe when the difference
    # is greater than 7 days
    if diff.days > 7:
        return date.strftime("%d. %b %Y")
    return arrow.get(date).humanize()
185930
def tgread_date(self):
        
        value = self.read_int()
        if value == 0:
            return None
        else:
            return datetime.fromtimestamp(value, tz=timezone.utc)
523891
def parse_date(date_str: str, pattern=_RE_DATE) -> dt.date:
    """"""

    groups = re.match(pattern, date_str)

    return dt.date(*_date_to_tuple(groups.groupdict()))
53905
def year(date):
    
    try:
        fmt = '%m/%d/%Y'
        return datetime.strptime(date, fmt).timetuple().tm_year
    except ValueError:
        return 0
1152690
def _join_date_and_time(dates, times, joiner):
  
  return tuple("{}{}{}".format(d, joiner, t) for (d, t) in itertools.product(dates, times))
214929
def mkIntDate(s):
    
    n = s.__len__()
    d = int(s[-(n - 1):n])

    return d
567605
def utctimetuple(self):
        ""
        offset = self.utcoffset()
        if offset:
            self -= offset
        y, m, d = self.year, self.month, self.day
        hh, mm, ss = self.hour, self.minute, self.second
        return _build_struct_time(y, m, d, hh, mm, ss, 0)
196009
def _pack_date(self, date):
        """"""
        
        # Just copied from original KeePassX source
        y, mon, d, h, min_, s = date.timetuple()[:6]

        dw1 = 0x0000FFFF & ((y>>6) & 0x0000003F)
        dw2 = 0x0000FFFF & ((y & 0x0000003F)<<2 | ((mon>>2) & 0x00000003))
        dw3 = 0x0000FFFF & (((mon & 0x0000003)<<6) | ((d & 0x0000001F)<<1) \
                | ((h>>4) & 0x00000001))
        dw4 = 0x0000FFFF & (((h & 0x0000000F)<<4) | ((min_>>2) & 0x0000000F))
        dw5 = 0x0000FFFF & (((min_ & 0x00000003)<<6) | (s & 0x0000003F))

        return struct.pack('<5B', dw1, dw2, dw3, dw4, dw5)
515191
def parse_date(dateString):
    ''''''
    if not dateString:
        return None
    for handler in _date_handlers:
        try:
            date9tuple = handler(dateString)
        except (KeyError, OverflowError, ValueError):
            continue
        if not date9tuple:
            continue
        if len(date9tuple) != 9:
            continue
        return date9tuple
    return None
804375
def mean_date(dt_list):
    
    dt_list_sort = sorted(dt_list)
    dt_list_sort_rel = [dt - dt_list_sort[0] for dt in dt_list_sort]
    avg_timedelta = sum(dt_list_sort_rel, timedelta())/len(dt_list_sort_rel)
    return dt_list_sort[0] + avg_timedelta
678892
def date(self):
    ''' 
    '''
    localtime = datetime.date.today()
    return localtime + datetime.timedelta(hours = time.timezone/60/60 + self.TimeZone)
419436
def _get_timestamp_tuple(ts):
    
    if isinstance(ts, datetime.datetime):    
        return Timestamp.from_datetime(ts).tuple()
    elif isinstance(ts, Timestamp):    
        return ts
    raise TypeError('Timestamp or datetime.datetime required')
1218051
def GetCalendarFieldValuesTuple(self):
    """"""
    if self.start_date and self.end_date:
      return [getattr(self, fn) for fn in self._FIELD_NAMES]