Datum & Tijd (MySQL): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
Regel 10: | Regel 10: | ||
created, from_unixtime(created), | created, from_unixtime(created), | ||
modified, from_unixtime(modified), | modified, from_unixtime(modified), | ||
+ | product_count from koolborstels.uc_orders where order_status="Completed" order by order_id asc limit 0,10; | ||
+ | </pre> | ||
+ | |||
+ | == unix_timestamp() == | ||
+ | |||
+ | Met <code>unix_timestamp()</code> converteer je een datum of tijd in een leesbaar formaat terug naar Unix Time: | ||
+ | |||
+ | <pre> | ||
+ | select | ||
+ | order_id, order_status, order_total, delivery_last_name, | ||
+ | |||
+ | created, from_unixtime(created), | ||
+ | unix_timestamp(from_unixtime(created)), | ||
+ | |||
product_count from koolborstels.uc_orders where order_status="Completed" order by order_id asc limit 0,10; | product_count from koolborstels.uc_orders where order_status="Completed" order by order_id asc limit 0,10; | ||
</pre> | </pre> |
Versie van 19 okt 2015 15:27
Tijdens het hacken van een Übercart-Drupal-database kwam ik eindelijk Unix time tegen! En hier zie je hoe ik er chocola van maak.
from_unixtim()
Met from_unixtime()
kun je unix tijds-waardes leesbaar formatteren:
elect order_id, order_status, order_total, delivery_last_name, created, from_unixtime(created), modified, from_unixtime(modified), product_count from koolborstels.uc_orders where order_status="Completed" order by order_id asc limit 0,10;
unix_timestamp()
Met unix_timestamp()
converteer je een datum of tijd in een leesbaar formaat terug naar Unix Time:
select order_id, order_status, order_total, delivery_last_name, created, from_unixtime(created), unix_timestamp(from_unixtime(created)), product_count from koolborstels.uc_orders where order_status="Completed" order by order_id asc limit 0,10;