• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create a date from mysql??

 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need to generate date from col which holds long values(this holds values like new java.util.Date(100L).getTime()) in mySQL. (just like new java.util.Date(100L))
any idea how to do this??

Thanks!
 
Rob Spoor
Sheriff
Pie
Posts: 20753
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out https://dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html. You'll probably want to use DATE_ADD to add the number of milliseconds to '1970-01-01'. Since that function doesn't support milliseconds, you can multiply the value by 1000 and use microseconds, or divide by 1000 and use seconds.
 
Supun Lakshan Dissanayake
Ranch Hand
Posts: 135
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:You'll probably want to use DATE_ADD to add the number of milliseconds to '1970-01-01'. Since that function doesn't support milliseconds, you can multiply the value by 1000 and use microseconds, or divide by 1000 and use seconds.


Yes. Exactly what i looking for. Thanks a LOT!
 
Rob Spoor
Sheriff
Pie
Posts: 20753
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic