Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!

2013-08-22 Thread hsv
 2013/08/22 14:22 -0400, Nick Cameo 
SimpleDateFormat sdf = new SimpleDateFormat("-MM-dd'T'HH:mm:ss", new 
Locale("en", "US"));

Well, you have your answer (FROM_UNIXTIME(   /1000)), but that stupid ISO 
format with 'T' in the middle does not work, because to MySQL letters are not 
separators--which, I am sorry to say, I did not say, although it was in the 
back of my mind.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!

2013-08-22 Thread Nick Cameo
Sorry, as was mentioned earlier:

select FROM_UNIXTIME(1377196112065/1000);
+---+
| FROM_UNIXTIME(1377196112065/1000) |
+---+
| 2013-08-22 18:28:32   |
+---+


Have a good day everyone :)

Nick.




Re: Java UTC Calendar and Mysql TimeStamp - Gets me every time!!!!!

2013-08-22 Thread Nick Cameo
On Wed, Aug 21, 2013 at 10:39 PM,  wrote:

>  2013/08/21 18:03 -0400, Nick Khamis 
> We have the following mysql timetampe field
>
> startdate | timestamp | NO   | | -00-00 00:00:00
>
> When trying to insert a long value in there:
>
> Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
> c.getTimeInMillis();
>
> We are presented with the following error:
>
> com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect
> datetime value: '1377119243640' for column 'stopdate' at row 1
> 
> Ugh, where is the SQL?
>
> In any case, although it looks as if that is MySQL s internal TIMESTAMP
> representation, one does not directly use Unix timestamps; instead, one
> converts them with the MySQL function FROM_UNIXTIME.
>
> The same effect may be gotten with any timestamp-formatting function that
> yields a string in the form '2013/08/21 18:03:00' (it is all one whether
> the separator is hyphen, slant, colon, ...).
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/mysql
>
>
What I am trying to accomplish is pass down a valid long value
(representative of UTC time)
that mysql timestamp field accepts, unix time epoch whatever That way,
I do not have to
fight with  java.sql.timestamp or java.sql.Date/Calander (for the
love!@E@#!@) for reads
and writes.

I can't use Joda until it has been included...

Deep breaths

What I tried is the following:

Straight Date:

update test set stopdate='2013-08-22T17:49:45'; -> Works Fine

Formatted Date (long):

SimpleDateFormat sdf = new SimpleDateFormat("-MM-dd'T'HH:mm:ss", new
Locale("en", "US"));
long qu = sdf.parse(sdf.format(c.getTime())).getTime();

update test set stopdate='1377194323000'; -> Zeros Out

Formatted Date (long with milliseconds):

c.getTimeInMillis()

update test set stopdate='1377195098956'; -> Zeros Out

Formatted Date (long with milliseconds/1000):

c.getTimeInMillis() / 1000

update test set stopdate='1377195098.956';

Can't change the table field to bigint either, it's an already existing
project.

Someone please help before I fire myself :).

Kind Regards,

Nick.


Re: MySQL version 3.23 to 5.x features

2013-08-22 Thread Nagaraj S
wow it really helped me a lot. I really thank Shawn,Dale Jesper for there
inputs


On Wed, Aug 21, 2013 at 7:13 PM, shawn green wrote:

> Hello Naga,
>
>
> On 8/21/2013 6:45 AM, Nagaraj S wrote:
>
>> Hello,
>>
>> Can anyone share the features/comparison from MySQL version 3.23 to 5.x in
>> single document? I can get from Google, however I have to navigate
>> different pages/sites, if it is in single document that will be useful to
>> see the overview of mysql features
>>
>>
> While not exactly just one single page for all changes, there is a single
> page of the fine manual within each new major version that describes the
> big features that are new or changed within that version.
>
> http://dev.mysql.com/doc/**refman/5.0/en/mysql-nutshell.**html
> http://dev.mysql.com/doc/**refman/5.1/en/mysql-nutshell.**html
> http://dev.mysql.com/doc/**refman/5.5/en/mysql-nutshell.**html
> http://dev.mysql.com/doc/**refman/5.6/en/mysql-nutshell.**html
>
> Unfortunately, to learn what we changed between 3.23 -> 4.0 or between 4.0
> -> 4.1, you are going to need to review the change logs
> http://dev.mysql.com/doc/**refman/4.1/en/news.html
>
>
> from 
> http://dev.mysql.com/doc/**refman/4.1/en/index.html
> 
> This manual describes features that are not included in every edition of
> MySQL 3.23, MySQL 4.0, and MySQL 4.1; such features may not be included in
> the edition of MySQL 3.23, MySQL 4.0, or MySQL 4.1; licensed to you.
> 
>
>
> I can pretty much summarize the deficiencies in 3.23 like this
> * No InnoDB, Archive, CSV, Federated, or Blackhole storage engines
> * No table partitioning
> * No Views
> * No Stored Procedures or Stored Functions
> * No Triggers
> * No Events
> * Severe scalability limits (won't run as fast with reasonably concurrent
> loads even on great hardware as later versions)
> * Completely out of print (unpublished) and unsupported.
> * Missing literally thousands of bug fixes and performance improvements
>
>
> Any new project should be starting out with 5.6.  Any production server
> should be on 5.5 or 5.6 by now or migrating soon. It is also a fairly safe
> bet that if you are still operating a 3.23 instance of MySQL that it is
> also time to upgrade your hardware.
>
> Regards,
> --
> Shawn Green
> MySQL Principal Technical Support Engineer
> Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
> Office: Blountville, TN
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/mysql
>
>