from datetime import datetime


def sqltime(timestamp = None):
	"""
	Convert the Unix-Timestamp to a SQL datetime
	If no timestamp given, returns the current datetime
	"""
	if timestamp:
		return datetime.fromtimestamp(int(timestamp)).strftime('%Y-%m-%d %H:%M:%S')
	else:
		return datetime.now().strftime('%Y-%m-%d %H:%M:%S')