View unanswered posts | View active topics It is currently Thu May 16, 2024 1:44 pm



Reply to topic  [ 3 posts ] 
AXIS_FORMAT_DATE Returns incorrect date 
Author Message
Regular pChart user
Regular pChart user

Joined: Fri Feb 25, 2011 5:35 pm
Posts: 11
Post AXIS_FORMAT_DATE Returns incorrect date
Hello,

I would like to format my mysql date (Y-M-D) to "d-m-y" format;

I have used
Code:
$MyData->setXAxisDisplay(AXIS_FORMAT_DATE,"m-d-Y");


But it returns always the date "01-01-1970" for all x-labels.

How can I solve this problem to get the correct date ??


Thanks a lot.


Wed Mar 02, 2011 2:03 pm
Profile
Regular pChart user
Regular pChart user

Joined: Tue Feb 08, 2011 10:36 pm
Posts: 14
Post Re: AXIS_FORMAT_DATE Returns incorrect date
what if you take the formatting out, in regards to trying to change the month,day, year around, does it still always show this date, that particular is what is used to configure the unix timestamp, have you checked the dates that are coming in for your data.

if ( $Mode == AXIS_FORMAT_DATE )
{ if ( $Format == NULL ) { $Pattern = "d/m/Y"; } else { $Pattern = $Format; } return(date($Pattern,$Value)); }

it looks like the pDraw class is using the date command for php, so you may want to test the date command in your php code to see if this is part of the problem.


Wed Mar 02, 2011 4:02 pm
Profile
Regular pChart user
Regular pChart user

Joined: Fri Feb 25, 2011 5:35 pm
Posts: 11
Post Re: AXIS_FORMAT_DATE Returns incorrect date
Thanks for reply,

My date is verified, i have values in all mysql lines, and it is always in mysql format : yyyy-mm-dd


I think that I will make a fonction to convert my dates in timestamp format (if AXIS_FORMAT_DATE don't accept mysql date format)

like this :

Code:
$date_sortie = array();
foreach($date1 as $cle=>$valeur)
    {
$valeur = strtotime($valeur);
       array_push($date_sortie, $valeur);
    }



Is that a good solution ?

Thanks.


Wed Mar 02, 2011 4:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron