strtotime() (funzione PHP) converte in formato timestamp una stringa che descrive in inglese un certo tempo.
tips&tricks
Sintassi
strtotime($tempo, $timestamp[facoltativo])
| parametro | descrizione |
|---|---|
| $tempo | Descrive la data in linguaggio naturale inglese (ad., es., “now”, “2 January 1972”, “-1 week 2 days 4 seconds”, “+1 month”) |
| $timestamp | Specifica la data da considerare nell’eventuale calcolo contenuto nel parametro $tempo |
Esempi
$data=strtotime("tomorrow");
echo date("d/m/Y", $data);
$data=strtotime("next Saturday");
echo date("d/m/Y", $data);
$data=strtotime("+3 Months");
echo date("d/m/Y", $data);
Contenuti correlati
- CSS
- HTML
- JavaScript
- jQuery
- PHP
- SQL
- WORDPRESS
0 Comment