diff options
author | Yader Velásquez <yajosev@gmail.com> | 2010-08-27 04:35:55 (GMT) |
---|---|---|
committer | Yader Velásquez <yajosev@gmail.com> | 2010-08-27 04:35:55 (GMT) |
commit | b4607aaa9e7f452f54adad6ae6525819a12ee191 (patch) | |
tree | 427c07d01cea007a00bf28417b057edbf50392ae /fecha.py | |
parent | 8aae2f622c489574b341130440241fc75eec90b9 (diff) |
nuevos cambios para marcelo
Diffstat (limited to 'fecha.py')
-rw-r--r-- | fecha.py | 48 |
1 files changed, 32 insertions, 16 deletions
@@ -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") + |