Last active
December 21, 2015 15:59
-
-
Save pabloprogramador/6330745 to your computer and use it in GitHub Desktop.
Data truques e ajustes
Ajuste de horário
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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