Convert timestamp to tick |
Here are a couple of methods you can play with:
PHP Code: // ----------------------------------------------------------------------- Good luck... What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-08-2018, 10:07 AM)InsiteFX Wrote: I found this article on stackoverflow: Thanks
(03-08-2018, 03:45 PM)InsiteFX Wrote: Here are a couple of methods you can play with: I need for mysql not php,can i convert it to mysql?
You should be able to convert it to MySQL.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Here are a couple more SQL Selects you can try:
PHP Code: SELECT FROM_UNIXTIME((`TIMESTAMP` / 1000)) as mytime FROM `table`; What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-09-2018, 10:47 PM)omid_student Wrote:(03-09-2018, 02:00 PM)InsiteFX Wrote: Here are a couple more SQL Selects you can try: But it was wrong and return Null
my code in java is
public String timeAgo(long millis) { long diff = new Date().getTime() - millis; double seconds = Math.abs(diff) / 1000; double minutes = seconds / 60; double hours = minutes / 60; double days = hours / 24; double years = days / 365; } In mention code,function current now minus my time according millisecond So i have to convert timestamp to millisecond
You could use the PHP DateTime::format
DateTime::format What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |