Skip to main content

Pasado, Presente y Futuro en PHP

Ayer me toco averiguar las siguientes fechas usando php, se los dejo por si les resultan utiles:

  • fecha inicial del mes actual:
    date("Y-m-d", mktime(0,0,0, date('m'), 1, date('Y')));
  • fecha final del mes actual
    date("Y-m-t");
  • fecha inicial del mes anterior
    date("Y-m-d",mktime(0, 0, 0, (date('m') - 1), 1, date('Y')));
  • fecha final del mes anterior
    date("Y-m-t",mktime(0, 0, 0, (date('m') - 1), date('t'), date('Y')));
  • fecha inicial del mes siguiente
    date("Y-m-d",mktime(0, 0, 0, (date('m') + 1), 1, date('Y')));
  • fecha final del mes siguiente
    date("Y-m-t",mktime(0, 0, 0, (date('m') + 1), date('d'), date('Y')));

Mucho ayuda el uso del formato "t"   en la funcion date que  representa el numero de dias en determinado mes.

Comments

Anonymous said…
Hola, acabo de leer este en tu blog , como ayudar a la gente web dando gran conocimiento!
Buen Trabajo , Bye y tener un gran 2011! Lo sentimos por mi mala español!

Popular posts from this blog

Ya tengo nuevo Disco

Pues eso... no podia estar mucho tiempo sin usar mi laptop y el fin de semana pasado me fui al DF a comprarme un nuevo disco: 80 Gb, 5400 revoluciones :) y de paso un case para accesar al disco nuevo a traves de USB.

Receta para preparar Cabeza de Res

Ingredientes 1 cabeza Costilla cargada de res unos pedazos para el sabor. Naranja agria o limón ( para lavar la Cabeza) 1/4 de chile guagillo 2 cabezas de ajo 1 cebolla 1/2 manojo de hoja de aguacate 2 hojas de momo o hier a santa (opcional) 3 cdas de mostaza 4 cdas de mayonesa Salsa inglesa al gusto 1 pedazito Achiote anita 1/2 taza de vinagre Comino al gusto Oregano al gusto Mejorana al gusto Tomillo al gusto Sal al gusto. Procedimiento -Se pone a cocer la carne ( previamente lavada con naranja agria o limon) con sal en la olla express o en olla normal con suficiente agua para que quede consome.  Que se cubra toda la cabeza con agua. - Se licua el Chile guagillo, ajo, cebolla, mayonesa , mostaza, inglesa , achiote y vinagre una vez licuado vaciar la mezcla colada a la cabeza. -Le agregas  el tomillo, mejorana, aguacate, momo y laurel a la olla. Si tienes hoja de platano con eso tapas la cabeza. Duracion de coccion es de 7 hrs aproximadamente para una cabeza.  SI TIENES ...

Sophie Baby Sounds Privacy Policy

Privacy Policy Rigoberto Reyes built the Sophie Baby Sounds app as a Free app. This SERVICE is provided by Rigoberto Reyes at no cost and is intended for use as is. This page is used to inform website visitors regarding my policies with the collection, use, and disclosure of Personal Information if anyone decided to use my Service. If you choose to use my Service, then you agree to the collection and use of information in relation to this policy. The Personal Information that I collect is used for providing and improving the Service. I will not use or share your information with anyone except as described in this Privacy Policy. The terms used in this Privacy Policy have the same meanings as in our Terms and Conditions, which is accessible at Sophie Baby Sounds unless otherwise defined in this Privacy Policy. Information Collection and Use This  Service  does not require you to provide us with any personally identifiable information.  The  Service...