Render a date/datetime (d) as a date, using the SPECTATOR_DATE_FORMAT
    setting. Wrap the output in a <time> tag.

    Time tags: http://www.brucelawson.co.uk/2012/best-of-time/
482620
def display_date(d):
    
    stamp = d.strftime('%Y-%m-%d')
    visible_date = d.strftime(app_settings.DATE_FORMAT)

    return format_html('<time datetime="%(stamp)s">%(visible)s</time>' % {
                'stamp': stamp,
                'visible': visible_date
            })
7565
def format_date(a_cell)
    isdate = true if(nil != (dt = a_cell.match(@date_RE)))
    isdate = true if(isdate || (nil != (dt = a_cell.match(@date_with_dashes_RE))) )
    isdate = true if(isdate || (nil != (dt = a_cell.match(@date_with_time_RE))) )
    if isdate
      begin
        mod_dt = DateTime.parse(a_cell)
        cary = "#{mod_dt.month}/#{mod_dt.day}/#{mod_dt.year}"
        if(true == verbose?)
          puts ""
          puts "*** Converted date to #{cary} ***"
          puts ""
        end
        a_cell = cary
      rescue ArgumentError => e
        # Either this is not a date, or the date format is unrecognized,
        # nothing to see here, moving on.
      end
    end
    a_cell
  end
855156
def format_datetime(date):
    
    # todo: test me
    if date.utcoffset() is None:
        return date.isoformat() + 'Z'

    utc_offset_sec = date.utcoffset()
    utc_date = date - utc_offset_sec
    utc_date_without_offset = utc_date.replace(tzinfo=None)
    return utc_date_without_offset.isoformat() + 'Z'
326102
def semantic_date_tag(date, options = {})
      SemanticDateTimeTags::Tag::Date.new(date, options).to_html
    end
1044515
def encode(self, value):
        
        if type(value) is not datetime.datetime:
            raise TypeError('encode() argument must be a Python datetime')

        return super(Time32Type, self).encode( dmc.toGPSSeconds(value) )
961054
def render_tag(self, tag_func):
        
        @wraps(tag_func)
        def tag_wrapper(parser, token):
            class RenderTagNode(template.Node):
                def render(self, context):
                    return tag_func(context, token)
            return RenderTagNode()
        return self.tag(tag_wrapper)
1026463
def to_datetime(data):
    
    my_date_time = None

    if 'published_parsed' in data:
        my_date_time = datetime.datetime.utcfromtimestamp(time.mktime(data.get('published_parsed')))
    elif 'created_parsed' in data:
        my_date_time = datetime.datetime.utcfromtimestamp(time.mktime(data.get('created_parsed')))
    elif 'updated_parsed' in data:
        my_date_time = datetime.datetime.utcfromtimestamp(time.mktime(data.get('updated_parsed')))
    elif 'my_date' in data:
        my_date_time = arrow.get(data['my_date'])

    return my_date_time
789439
def to_time(datetime, complete_date: :first, **opts)
			require 'time'
			return Time.now if datetime == :now
			begin
				fallback=Time.new(0) #supply the missing components
				return Time.parse(datetime,fallback)
			rescue ArgumentError
				year,month,day,time=split_date(datetime)
				case complete_date
				when :first
					month="01" if month == nil
					day="01" if day == nil
					time="00:00:00" if day == nil
				when :last
					month="12" if month == nil
					day=Months_end[month.to_i].to_s if day == nil
					time="23:59:59" if day == nil
				end
				return Time.parse("#{year}-#{month}-#{day}T#{time}",fallback)
			end
		end
455888
def datetime_to_httpdate(dt):
    """"""
    if isinstance(dt, (int, float)):
        return format_date_time(dt)
    elif isinstance(dt, datetime):
        return format_date_time(datetime_to_timestamp(dt))
    else:
        raise TypeError("expected datetime.datetime or timestamp (int/float),"
                        " got '%s'" % dt)
1132450
def datetime_to_http_date(the_datetime):
    
    timeval = calendar.timegm(the_datetime.utctimetuple())
    return formatdate(timeval=timeval,
                      localtime=False,
                      usegmt=True)
1362048
def format_date(ctx, text):
    
    dt = conversions.to_datetime(text, ctx)
    return dt.astimezone(ctx.timezone).strftime(ctx.get_date_format(True))
1045962
def asdatetime(self, naive=True):
    
    args = list(self.timetuple()[0:6])+[self.microsecond]
    if not naive:
      args.append(self.tzinfo)
    return datetime.datetime(*args)
611079
protected function renderDateTime(DateTime $date = null, $format = DateTimeRenderer::DATETIME_FORMAT) {
        return DateTimeRenderer::renderDateTime($date, $format);
    }
1125656
def display_event_time(event, day)
      time = event.start_at
      if !event.all_day and time.to_date == day
        # try to make it display as short as possible
        format = (time.min == 0) ? "%l" : "%l:%M"
        t = time.strftime(format)
        am_pm = time.strftime("%p") == "PM" ? "p" : ""
        t += am_pm
        %(<span class="ec-event-time">#{t}</span>)
      else
        ""
      end
    end
1338786
def output_date(datetime, output_date: :abbr, output_date_length: :month,
			**opts)
			lang=opts[:lang]||:en
			year,month,day,time=split_date(datetime)
			month=nil if output_date_length==:year
			day=nil if output_date_length==:month
			time=nil if output_date_length==:day
			return Formatter.localize({en: 'Present', fr: 'Présent'},**opts) if datetime==:now
			r=year
			case output_date
			when :num
				month.nil? ? (return r) : r+="-"+month
				day.nil? ? (return r) : r+="-"+day
				time.nil? ? (return r) : r+="T"+time
			when :abbr,:string
				return r if month.nil?
				month_name=Months_names[lang][month.to_i]
				month_name=abbr_month(month_name) if output_date==:abbr
				r=month_name+" "+r
				return r if day.nil?
				r=day+" "+r
				return r if time.nil?
				r+=" "+time
			end
			r
		end
741648
def _build_time(time, kwargs):
    
    tz = kwargs.pop('tz', 'UTC')
    if time:
        if kwargs:
            raise ValueError('Cannot pass kwargs and a time')
        else:
            return ensure_utc(time, tz)
    elif not kwargs:
        raise ValueError('Must pass a time or kwargs')
    else:
        return datetime.time(**kwargs)
873467
def um_date_to_date(d):
    

    return datetime.datetime(year=d[0], month=d[1], day=d[2],
                             hour=d[3], minute=d[4], second=d[5])