Monday, 21 December 2009

Convert a mysql date or time to a datetime you can use in an hsqldb

Here is how to convert a mysql date or time to a datetime you can use in an hsqldb INSERT statement.

select date_format(name_of_date_column, '%Y-%m-%d %H:%i:%s') from table_containing_date_column

Monday, 13 July 2009

Using date format from Toad for MySQL

By default in my locale (UK) Toad for MySQL displays this date format for 9:30ish on July 10.

'10/07/2009 09:30:48'

However, if I try to use that format in a SQL command in the editor, for example

SELECT * FROM foo WHERE changed = '10/07/2009 09:30:48'

I get this error

Commands out of sync; You can't run this command now

The default date format is 'YYYY-MM-DD HH:MM:SS' so I could do

SELECT * FROM foo WHERE changed = '2009/07/10 09:30:48'

or use STR_TO_DATE and do

SELECT * FROM foo WHERE changed = STR_TO_DATE('10/07/2009 09:30:48','%d/%m/%Y %H:%i:%s');

Tuesday, 2 June 2009

Getting a change log from cvs

Thank you cvs2cl!

It creates a nice delta of the comments in changes between tagged releases. For example, to get the changes from tag R8 to tag R9 for the module called jam:
cvs2cl.pl --delta R8:R9 jam
Though the help says this:
--delta FROM_TAG:TO_TAG
Attempt a delta between two tags (since FROM_TAG up to and including
TO_TAG). The algorithm is a simple date-based one (this is a hard
problem) so results are imperfect.