From b4607aaa9e7f452f54adad6ae6525819a12ee191 Mon Sep 17 00:00:00 2001 From: Yader Velásquez Date: Fri, 27 Aug 2010 04:35:55 +0000 Subject: nuevos cambios para marcelo --- (limited to 'fecha.py') diff --git a/fecha.py b/fecha.py index dc12746..000d30c 100644 --- a/fecha.py +++ b/fecha.py @@ -19,32 +19,48 @@ from time import localtime, strftime, mktime from datetime import datetime -def fecha(): - '''return a friendly date''' - fecha = datetime.today() - return fecha.strftime("%d de %B de %Y") +#def fecha_actual(): +# '''return a friendly date''' #esta fecha es la que se muestra arriba del calendario +# fecha = datetime.today() +# return fecha.strftime("%d de %B de %Y") -def fecha_cadena(): - '''return a string of the date''' - fecha = datetime.today() - return fecha.strftime("%y-%b-%d") +#def fecha_cadena(): +# '''return a string of the date''' #este es el formato de fecha para los indices de efemerides +# fecha = datetime.today() +# return fecha.strftime("%y-%b-%d") -class Fecha(object): - '''a simple class for get and convert date''' +class FechaUnix(object): + '''for get, convert and return dates based on the unix date''' def __init__(self, lista): '''init class''' self.fecha = datetime(lista[0], lista[1] + 1, lista[2]) #Calendar signal return month -1 - def convertir(self): - '''convert to unix date''' - self.fecha_unix = mktime(self.fecha.timetuple()) + def fecha_unix(self): + '''return a string of the actual date in unix format''' + self.fecha_unix = mktime(self.fecha.timetuple()) #guarda a fecha unix para guardar en las actividades self.fecha_unix = int(self.fecha_unix) return str(self.fecha_unix) - def formatear(self): - '''date formated''' - self.fecha_unix = mktime(self.fecha.timetuple()) + def fecha_formato(self, fecha_unix): + '''return a nice date from an unix date''' + self.fecha_unix = fecha_unix self.fecha_unix = int(self.fecha_unix) return strftime("%d de %b de %Y", localtime(self.fecha_unix)) +class FechaNormal(object): + '''for get, convert and return dates in our popular format''' + def __init__(self): + '''nothing to say''' + + def fecha_actual(self): + '''return the actual date''' + self.fecha = datetime.today() + return self.fecha.strftime("%y-%b-%d") + + def fecha_especial(self): + '''special format of a date for + be use it like a dicctionary key''' + self.fecha = datetime.today() + return self.fecha.strftime("%y-%b-%d") + -- cgit v0.9.1