Jump to content
Fórum Script Brasil
  • 0

Timestamp mes anterior


tlima

Question

alguém saberia me informar como calculo o timestamp de uma data, levando em consideracao que o timestamp deve comecar no inicio do dia as 00:00:00 do dia. por exemplo, no codigo abaixo consigo gerar o timestamp dos 30 dias anteriores, porem não com a data de 00:00:00 desse dia

$dataIntervalo = mktime() - 30*3600*24;
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Resolvi aqui:

//variavel que grava a data atual no formato timestamp

$dataAtual = date('d/m/Y');

//variavel que grava a data de 30 dias atras no formato timestamp

$dataArray = explode("/",$dataAtual);

$limite = 31;

$dataLimite = date("Y-m-d",mktime(0,0,0,$dataArray[1],$dataArray[0] - $limite ,$dataArray[2]));

$dataLimiteHora = $dataLimite." 00:00:00";

$dataLimite = strtotime($dataLimiteHora);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...