[Phpmyadmin-devel] Zoom-search and dates

Ammar Yasir ammaryasir.88 at gmail.com
Thu Aug 11 22:17:16 CEST 2011


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.

[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
>>
>>
>> ------------------------------------------------------------------------------
>> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
>> The must-attend event for mobile developers. Connect with experts.
>> Get tools for creating Super Apps. See the latest technologies.
>> Sessions, hands-on labs, demos & much more. Register early & save!
>> http://p.sf.net/sfu/rim-blackberry-1
>> _______________________________________________
>> Phpmyadmin-devel mailing list
>> Phpmyadmin-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>>
>
>
>
> ------------------------------------------------------------------------------
> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
> The must-attend event for mobile developers. Connect with experts.
> Get tools for creating Super Apps. See the latest technologies.
> Sessions, hands-on labs, demos & much more. Register early & save!
> http://p.sf.net/sfu/rim-blackberry-1
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20110812/c55c8be5/attachment.html>


More information about the Developers mailing list