Bonjour,
J'utilise une requete pour sortir les resultats sur les 30 derniers jours et jusqua present je n'ai jamais eu de probleme. Et je viens d'en avoir en cette fin d'année (bug de l'an 2009 )
Voici ma reqeute:
Code :
- SELECT ".DB_PROJET.".id_projet, nom_projet, today.user_credit AS tot_credit,
- DATE_FORMAT(today.date_maj, '%x-%m-%d') AS today_test,
- DATE_FORMAT(SUBDATE(today.date_maj, 1), '%x-%m-%d') AS today,
- UNIX_TIMESTAMP(SUBDATE(today.date_maj, 1)) AS today_ts
- FROM ".DB_TEAM_PJT.", ".DB_PROJET.", ".DB_STAT_LIST_USER.", ".DB_STAT_USER." AS today
- WHERE ".DB_STAT_LIST_USER.".id_nom_user='".MyAddSlashes($_GET['id'])."'
- AND ".DB_STAT_LIST_USER.".id_team_pjt=".DB_TEAM_PJT.".id_team_pjt
- AND ".DB_TEAM_PJT.".id_projet=".DB_PROJET.".id_projet
- AND ".DB_STAT_LIST_USER.".id_user=today.id_user
- AND HOUR(today.date_maj)='00'
- AND today.date_maj>FROM_UNIXTIME(".$Day_30." )
- ORDER BY nom_projet, today.date_maj ASC
|
Et voici ce qu'elle me sort:
Citation :
[...]
Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 308000 [today_test] => 2008-12-24 [today] => 2008-12-23 [today_ts] => 1229986800 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311000 [today_test] => 2008-12-25 [today] => 2008-12-24 [today_ts] => 1230073200 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2008-12-26 [today] => 2008-12-25 [today_ts] => 1230159600 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2008-12-27 [today] => 2008-12-26 [today_ts] => 1230246000 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2008-12-28 [today] => 2008-12-27 [today_ts] => 1230332400 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-12-29 [today] => 2008-12-28 [today_ts] => 1230418800 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-12-30 [today] => 2009-12-29 [today_ts] => 1230505200 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-12-31 [today] => 2009-12-30 [today_ts] => 1230591600 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-01-01 [today] => 2009-12-31 [today_ts] => 1230678000 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-01-02 [today] => 2009-01-01 [today_ts] => 1230764400 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-01-03 [today] => 2009-01-02 [today_ts] => 1230850800 ) Array ( [id_projet] => 30 [nom_projet] => 3x+1@home [tot_credit] => 311300 [today_test] => 2009-01-04 [today] => 2009-01-03 [today_ts] => 1230937200 )
|
L'année des 3 derniers jours de decembre est 2009!!??! Pourtant le timestamp est correct il correspond a 2008 et pas 2009. la colonne date_maj est stockée dans un datetime.
Est ce que ce genre de probleme vous evoque quelque chose? Merci pour votre aide
Message édité par IvanleFou le 04-01-2009 à 17:43:04