[Phpmyadmin-devel] Zoom-search and dates
Marc Delisle
marc at infomarc.info
Fri Aug 12 16:08:25 CEST 2011
Le 2011-08-11 16:17, Ammar Yasir a écrit :
> Hi,
>
> I pushed my work. What I tried was to convert each of the date into UNIX
> timestamp, which generated milliseconds passed since 1970-01-01 00:00:00. I
> used the inbuit php function to str2time() for that and while testing I
> found out that it does not supports dates before 1970 ( ideally it should
> have given negative value). I then worked around to convert date into
> timestamp in my javascript code. The date object in js does not support the
> timestamp data type from MySQL, so conversion to and from had to be done
> manually. I had to use the library at [0] for parsing a string to timestamp.
> It now provides a meaningful distance measure between dates. I lost a bit of
> time working around this, will work on panning feature now.
Ammar,
testing with commit 201331275bff7e3e67e3d5f3fb2bc706e302ad27, I have two
problems:
1. with my test table birthday, I see no dates at all in the plot
2. Warning in ./libraries/core.lib.php#704
filemtime() [function.filemtime]: stat failed for ./js/canvg/rgbcolor.js
>
> [0] http://www.mattkruse.com/javascript/date/source.html
>
> On Tue, Aug 2, 2011 at 10:55 PM, Ammar Yasir <ayax88 at gmail.com> wrote:
>
>>
>>
>> On Tue, Aug 2, 2011 at 10:24 PM, Marc Delisle <marc at infomarc.info> wrote:
>>
>>> Ammar,
>>>
>>> Zoom-search of date values needs improvement. Here is an example table:
>>>
>>> CREATE TABLE IF NOT EXISTS `birthday` (
>>> `id` int(11) NOT NULL AUTO_INCREMENT,
>>> `name` varchar(50) NOT NULL,
>>> `birthday` date NOT NULL,
>>> PRIMARY KEY (`id`)
>>> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
>>>
>>>
>>> INSERT INTO `birthday` (`id`, `name`, `birthday`) VALUES
>>> (1, 'A', '1950-01-01'),
>>> (2, 'B', '1950-02-02'),
>>> (3, 'C', '1960-03-03'),
>>> (4, 'D', '2000-04-04');
>>>
>>> Generating a plot via zoom-search show that the same time elapsed
>>> between two days (in 1950) than in ten or forty years.
>>>
>>> If you could convert these dates to a number of days (probably at the
>>> Javascript layer), the same way than in MySQL [0], you would get
>>> meaningful results. Of course you still need to display the unconverted
>>> date value.
>>>
>>> [0]
>>>
>>> http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_to-days
>>>
>>> I looked up in the reference manual and I think Highcharts will do that
>> automatically ( calculate distance between dates) if we can convert the date
>> into specific format, like the *dateFormat* function specified [0] will
>> probably work.
>> I'll need to have cases for each of the date and time types in MySQL [1] (
>> format to be chosen accordingly, like for datetime: '%e. %b %Y, %H:%M:%S'
>> and for year: ' %Y ' only)
>>
>> [0] http://www.highcharts.com/ref/#highcharts-object
>> [1] http://dev.mysql.com/doc/refman/5.0/en/date-and-time-types.html
>>
>> --
>>>
>>> Marc Delisle
>>> http://infomarc.info
--
Marc Delisle
http://infomarc.info
More information about the Developers
mailing list