Skip to content

Instantly share code, notes, and snippets.

@pabloprogramador
Last active December 21, 2015 15:59
Show Gist options
  • Select an option

  • Save pabloprogramador/6330745 to your computer and use it in GitHub Desktop.

Select an option

Save pabloprogramador/6330745 to your computer and use it in GitHub Desktop.
Data truques e ajustes Ajuste de horário
<?php
date_default_timezone_set("Brazil/East");
//echo strtotime(date('Y-m-d H:i:s',time())); exemplo de redundancia
//BUSCA SQL DE UMA DATA MENOR NAO TIMESTAMP
->where('UNIX_TIMESTAMP(STR_TO_DATE(DATA,"%d/%m/%Y")) <',now())
date("d/m/Y H:i:s a",time()); //30/12/2013 23:50:15 pm
//VARIOS DIAS
$timestamp = time();
$dias = ($timestamp)/(60*60*24)
//CONVERTE DATA PADRAO PARA TIMESTAMP
$a = strptime($valor, '%d/%m/%Y');
$timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year']+1900);
$aux = ($timestamp < now()) ? 'background-color:#FDD5D5;' : '';
//CONVERTER DATA INPUT PARA DATETIME
15/12/2013
$date = date("Y-m-d H:i:s",strtotime(str_replace('/','-',$data)));
//CONVER DATATIME PARA STRING
date("d/n/Y", strtotime("2009-10-04 22:23:00"))
date("d/n/Y", strtotime("+1 day"))
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment