How to convert decimal(16,4) to DATE or DATETIME in SQL or PHP

后端 未结 3 1964
野趣味
野趣味 2021-01-15 00:18

I have a small problem with a field of my db... the submit time is in decimal(16,4) type and I need to convert it to DATE or DATETIME... but I dont get it...

One exa

相关标签:
3条回答
  • 2021-01-15 00:30

    in SQL 'select dateadd(ss, 1334041225.5900, '19700101')'

    0 讨论(0)
  • 2021-01-15 00:45

    This appears to be a unix timstamp with fractions of seconds, in which case....

    print date('r', 1334041225.5900);
    

    (it is possible that this numbering system intersects with Unix timestamps at 2012-04-10 09:00:25 +02:00).

    See the manual page for the date function for details of specifics.

    It's prob ably possible to do the conversion in SQL but you didn't say what type of DBMS this is.

    0 讨论(0)
  • 2021-01-15 00:46

    Before going to insert the decimal u have to convert those decimal values into date format using this statements, echo strtotime(date('Y-m-d H:i:s',1334041225.5900));

    0 讨论(0)
提交回复
热议问题