Returns some thing like '2019-02-15 15:58:22 CET+0100
331891
def pretty_now():
    """'"""
    import datetime, tzlocal
    time_zone = tzlocal.get_localzone()
    now       = datetime.datetime.now(time_zone)
    return now.strftime("%Y-%m-%d %H:%M:%S %Z%z")
1141522
public String getTimeUnitAbbreviation() {
    switch (timeUnit) {
      case DAYS:
        return "day";
      case HOURS:
        return "hr";
      case MICROSECONDS:
        return "\u00B5s";
      case MILLISECONDS:
        return "ms";
      case MINUTES:
        return "min";
      case NANOSECONDS:
        return "ns";
      case SECONDS:
        return "s";
      default:
        return "unkwn";
    }
  }
939372
def strptime(string, timezone=0):
    """"""
    year = int(string[0:4])
    month = int(string[5:7])
    day = int(string[8:10])
    hour = int(string[-5:-3])
    minute = int(string[-2:])
    ts = datetime.datetime(year, month, day) + \
        datetime.timedelta(hours=hour, minutes=minute) - \
        datetime.timedelta(hours=timezone)
    return ts
317429
def dateheure(objet):
        
        if objet:
            return "{}/{}/{} à {:02}:{:02}".format(objet.day, objet.month, objet.year, objet.hour, objet.minute)
        return ""
814819
def date(fmt=None,timestamp=None):
    ""
    if fmt=='U': # return timestamp
        t = datetime.datetime.now()
        return int(time.mktime(t.timetuple()))
    if fmt=='c': # return isoformat 
        d = datetime.datetime.fromtimestamp(timestamp)
        return d.isoformat()
    if fmt=='Ymd':
        d = datetime.datetime.now()
        return d.strftime("%Y%m%d")
737465
function toAmzUtcString(date) {
  var pieces = new Date(date).toUTCString().match(/^(.+), (.+) (.+) (.+) (.+) GMT$/)
  return [pieces[1], pieces[3], pieces[2], pieces[5], 'UTC', pieces[4]].join(' ')
}
446137
def pretty_time(timestamp: str):
    """"""
    try:
        parsed = iso_8601.parse_datetime(timestamp)
    except ValueError:
        now = datetime.utcnow().replace(tzinfo=timezone.utc)
        try:
            delta = iso_8601.parse_delta(timestamp)
        except ValueError:
            delta = human_time.parse_timedelta(timestamp)
        parsed = now - delta

    echo(human_time.human_timestamp(parsed))
422864
def dateDict(date, prefix = ""):
    """"""
    res = {}

    res[prefix+"a"] = date.strftime("%a")
    res[prefix+"A"] = date.strftime("%A")
    res[prefix+"b"] = date.strftime("%b")
    res[prefix+"B"] = date.strftime("%B")
    res[prefix+"c"] = date.strftime("%c")
    res[prefix+"d"] = date.strftime("%d")
    res[prefix+"H"] = date.strftime("%H")
    res[prefix+"I"] = date.strftime("%I")
    res[prefix+"j"] = date.strftime("%j")
    res[prefix+"m"] = date.strftime("%m")
    res[prefix+"M"] = date.strftime("%M")
    res[prefix+"p"] = date.strftime("%p")
    res[prefix+"S"] = date.strftime("%S")
    res[prefix+"U"] = date.strftime("%U")
    res[prefix+"w"] = date.strftime("%w")
    res[prefix+"W"] = date.strftime("%W")
    res[prefix+"x"] = date.strftime("%x")
    res[prefix+"X"] = date.strftime("%X")
    res[prefix+"y"] = date.strftime("%y")
    res[prefix+"Y"] = date.strftime("%Y")
    res[prefix+"Z"] = date.strftime("%Z")

    for i, value in res.items():
        res[i] = locale_to_utf8(value)

    return res
1296863
function getLetterTime(timeString) {
  var totalSeconds = 0;
  var timeValues = {
    's': 1,
    'm': 1 * 60,
    'h': 1 * 60 * 60,
    'd': 1 * 60 * 60 * 24,
    'w': 1 * 60 * 60 * 24 * 7,
  };
  var timePairs;

  //expand to "1 h 30 m 20 s" and split
  timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim();
  timePairs = timeString.split(' ');

  for (var i = 0; i < timePairs.length; i += 2) {
    totalSeconds += parseInt(timePairs[i], 10) *
      timeValues[timePairs[i + 1] || 's'];
  }
  return totalSeconds;
}
678892
def date(self):
    ''' 
    '''
    localtime = datetime.date.today()
    return localtime + datetime.timedelta(hours = time.timezone/60/60 + self.TimeZone)
819022
def tzname(self, dt):
        """"""
        tt = _localtime(_mktime((dt.year, dt.month, dt.day,
                 dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1)))
        return _time.tzname[tt.tm_isdst > 0]
119056
def _dump_date(d, delim):
    """"""
    if d is None:
        d = gmtime()
    elif isinstance(d, datetime):
        d = d.utctimetuple()
    elif isinstance(d, (integer_types, float)):
        d = gmtime(d)
    return "%s, %02d%s%s%s%s %02d:%02d:%02d GMT" % (
        ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")[d.tm_wday],
        d.tm_mday,
        delim,
        (
            "Jan",
            "Feb",
            "Mar",
            "Apr",
            "May",
            "Jun",
            "Jul",
            "Aug",
            "Sep",
            "Oct",
            "Nov",
            "Dec",
        )[d.tm_mon - 1],
        delim,
        str(d.tm_year),
        d.tm_hour,
        d.tm_min,
        d.tm_sec,
    )
1084006
def _x_format(self):
        """"""

        def date_to_str(x):
            t = seconds_to_time(x)
            return self.x_value_formatter(t)

        return date_to_str
822975
def datetime(self):
        
        date_string = '%s %s' % (self._date, self._time.upper())
        date_string = re.sub(r'/.*', '', date_string)
        date_string = re.sub(r' ET', '', date_string)
        date_string += 'M'
        date_string = re.sub(r'PMM', 'PM', date_string, flags=re.IGNORECASE)
        date_string = re.sub(r'AMM', 'AM', date_string, flags=re.IGNORECASE)
        date_string = re.sub(r' PM', 'PM', date_string, flags=re.IGNORECASE)
        date_string = re.sub(r' AM', 'AM', date_string, flags=re.IGNORECASE)
        return datetime.strptime(date_string, '%a, %b %d, %Y %I:%M%p')
1343856
def time_to_text(time):
    """"""
    
    if time < 0.001:
        return str(round(time * 1000000)) + " µs"
    elif time < 1:
        return str(round(time * 1000)) + " ms"
    elif time < 60:
        return str(round(time, 1)) + " s"
    else:
        return str(round(time / 60, 1)) + " min"
318935
private String xFormat() {
    long timespan = (end_time & UNSIGNED) - (start_time & UNSIGNED);
    if (timespan < 2100) {  // 35m
      return "%H:%M:%S";
    } else if (timespan < 86400) {  // 1d
      return "%H:%M";
    } else if (timespan < 604800) {  // 1w
      return "%a %H:%M";
    } else if (timespan < 1209600) {  // 2w
      return "%a %d %H:%M";
    } else if (timespan < 7776000) {  // 90d
      return "%b %d";
    } else {
      return "%Y/%m/%d";
    }
  }
907836
def date(objet):
        
        if objet:
            return "{}/{}/{}".format(objet.day, objet.month, objet.year)
        return ""