I put this pseudocode that I know doesn't work to explain what I want to do:
resultado = 0
fecha1 = 2000,1,1 2:21
fecha2 = 2001,1,1 4:44
resultado = fecha1-getAño();
resultado = fecha2-gerHora()
dump(resultado) // 2011,1,1 T4:44
From what I'm seeing, I have to decompose the dates into year, month, days, hour, minute, second, and then recompose them into one...
Isn't there another more direct way? There has to be an easier way!!
One of the class's constructors
DateTime
needs to receive astring
"yyyy-MM-dd hh:mm:ss" type. Playing with the functionformat
of the objects of the classDateTime
you can build a thirdDateTime
with the union of the date and the time.EDIT
You could also do the reverse. Starting from an initial date, break it down to get the date on the one hand and the time on the other. As you can see the function
format
is very useful.