SQL >> Database teknologi >  >> RDS >> Mysql

Formatér Ruby DateTime til MySQL

Rails giver Time.now.to_s(:db) i formatet YYYY-MM-DD HH:MM:SS.

Brug UTC eksplicit, eller lad databasen levere tiden med NOW(). I ActiveRecord kan tidsintervaller bruges direkte.

  1. Konvertering af DateTime til MySQL-format i C#

  2. Gem datetimes som UTC i PHP og MySQL

  3. Opdatering af kun tidsdelen af en MySQL DateTime

  4. MySQL Incorrect Datetime Value forårsaget af sommertid