|
| HOMEPAGE | INDICE FORUM | REGOLAMENTO | ::. | NEI PREFERITI | .:: | RSS Forum | RSS News | NEWS web | NEWS software | |
| PUBBLICITA' | | | ARTICOLI | WIN XP | VISTA | WIN 7 | REGISTRI | SOFTWARE | MANUALI | RECENSIONI | LINUX | HUMOR | HARDWARE | DOWNLOAD | | | CERCA nel FORUM » | |
27-04-2007, 15.28.15 | #1 |
Forum supporter
Registrato: 22-01-2003
Messaggi: 1.698
|
[php] visualizzare date salvate in campo DATE
Ho inserito in un campo date (con nome "giorno") della tabella di un db mysql delle date tramite una query usando la funzione NOW(). Avrei necessità di visualizzarle ed aggiungere un giorno alle varie date. In pratica dovrei visualizzare la data salvata nel campo del tipo 2007-04-23 e poi farla diventare: 2007-04-24 ad esempio. Ma non ho capito perchè non riesco a richiamarla dal db e non so nemmeno come aggiungervi un giorno. Potete aiutarmi? Grazie
___________________________________
CPU CORE 2 DUO E6600, ASUS P5LD2/C R2.0, DDR2 4GB PC533 KINGSTON, SSD Crucial M500 120GB, NVIDIA GeForce GT 610 |
27-04-2007, 21.32.55 | #2 |
WT Assistant
Registrato: 19-12-2000
Loc.: Cambiano (Torino)
Messaggi: 591
|
update table_name set date_field = date_field + 1
___________________________________
There are 10 kinds of people in this world, those who can read binary and those who can't. Care to say "thank you"? |
27-04-2007, 22.30.11 | #3 | |
Forum supporter
Registrato: 22-01-2003
Messaggi: 1.698
|
Quota:
No, la devo stampare prima nella pagina ed inserirla in una variabile e poi aggiungere 1 giorno e salvare la nuova data in una variabile non la devo salvare nel campo. Grazie
___________________________________
CPU CORE 2 DUO E6600, ASUS P5LD2/C R2.0, DDR2 4GB PC533 KINGSTON, SSD Crucial M500 120GB, NVIDIA GeForce GT 610 |
|
27-04-2007, 22.35.03 | #4 |
WT Assistant
Registrato: 19-12-2000
Loc.: Cambiano (Torino)
Messaggi: 591
|
[PHP]function from_iso8601_date($isodate, &$y, &$m, &$d)
{ $y = date('Y', strtotime($isodate)); $m = date('m', strtotime($isodate)); $d = date('d', strtotime($isodate)); } function giorno_succ($data, $as_unixts = false) { static $date = array(); if (!array_key_exists($data, $date)) { $y = $m = $d = 0; from_iso8601_date($data, $y, $m, $d); $unixts = mktime(2, 0, 0, $m, ($d + 1), $y, 1); $date[$data] = array( 'iso' => date('Y-m-d', $unixts), 'unix' => $unixts ); } return $as_unixts ? $date[$data]['unix'] : $date[$data]['iso']; } $giorno_successivo = giorno_succ('2007-04-23'); [/PHP]
___________________________________
There are 10 kinds of people in this world, those who can read binary and those who can't. Care to say "thank you"? |
Utenti attualmente attivi che stanno leggendo questa discussione: 1 (0 utenti e 1 ospiti) | |
Strumenti discussione | |
|
|
Discussioni simili | ||||
Discussione | Autore discussione | Forum | Risposte | Ultimo messaggio |
[VB6] Sottrazione tra 2 date | Jamester | Programmazione | 1 | 10-05-2008 17.27.31 |
[Special Edition] Bar Sport: Campioni Del Mondo!!! | Flying Luka | Chiacchiere in libertà | 1840 | 24-05-2007 02.07.47 |
[ACCESS] Aggiornamento automatico di un campo | RunDLL | Office suite | 13 | 19-03-2007 14.01.08 |
[php] idee per questionario online | bietolino | Programmazione | 1 | 20-01-2007 22.55.20 |
[SQL ACCESS]Problema con le date. | Fast-M | Programmazione | 3 | 12-07-2006 18.27.59 |