pymensago/contactdb.py
def _date_to_str(date: str) -> str:
	'''Converts the short form UTC date format to a localized string'''
	
	global _long_date_pattern
	global _short_date_pattern

	mon, day, year = (0,0,0)
	match = _long_date_pattern.match(date)
	if match:
		mon = int(date[4:6])
		day = int(date[6:8])
		year = int(date[0:4])
	else: 				
		match = _short_date_pattern.match(date)
		if match:
			mon = int(date[0:2])
			day = int(date[2:4])
	
	if not mon or not day:	
		return ''
	
	if year:
		return time.strftime("%B %d %Y",datetime.datetime(year, mon, day).timetuple())
	else:
		return time.strftime("%B %d",datetime.datetime(datetime.datetime.today().year, mon, 
							day).timetuple())
Converts the short form UTC date format to a localized string
Converts the short form UTC date format to a localized string
Converts the short form UTC date format to a localized string
def _date_to_str(date: str) -> str:
	global _long_date_pattern
	global _short_date_pattern
	mon, day, year = (0,0,0)
	match = _long_date_pattern.match(date)
	if match:
		mon = int(date[4:6])
		day = int(date[6:8])
		year = int(date[0:4])
	else: 				
		match = _short_date_pattern.match(date)
		if match:
			mon = int(date[0:2])
			day = int(date[2:4])
	if not mon or not day:	
		return ''
	if year:
		return time.strftime("%B %d %Y",datetime.datetime(year, mon, day).timetuple())
	else:
		return time.strftime("%B %d",datetime.datetime(datetime.datetime.today().year, mon, 
							day).timetuple())
def _date_to_str ( date : str ) -> str : global _long_date_pattern global _short_date_pattern mon , day , year = ( 0 , 0 , 0 ) match = _long_date_pattern . match ( date ) if match : mon = int ( date [ 4 : 6 ] ) day = int ( date [ 6 : 8 ] ) year = int ( date [ 0 : 4 ] ) else : match = _short_date_pattern . match ( date ) if match : mon = int ( date [ 0 : 2 ] ) day = int ( date [ 2 : 4 ] ) if not mon or not day : return '' if year : return time . strftime ( "%B %d %Y" , datetime . datetime ( year , mon , day ) . timetuple ( ) ) else : return time . strftime ( "%B %d" , datetime . datetime ( datetime . datetime . today ( ) . year , mon , day ) . timetuple ( ) )
Converts the short form UTC date format to a localized string
Converts the short form UTC date format to a localized string
'''Converts the short form UTC date format to a localized string'''
date
str