Title: date in database
Last modified: December 19, 2017

---

# date in database

 *  Resolved [mads](https://wordpress.org/support/users/madstudio/)
 * (@madstudio)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/date-in-database/)
 * Hello,
 * how can i store a date in the database?
 * Thanks.
    Best regards, Mads

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/date-in-database/#post-9797432)
 * Hello [@madstudio](https://wordpress.org/support/users/madstudio/),
 * I’m sorry, I’m not sure about your question. What version of the plugin you are
   using, and what field you want store and where?
 * For example, assuming you are using the Developer or Platinum versions of the
   plugin and you want to store the value of the fieldname1 field (that is a date/
   time field) in your own database editing the “cp_calculatedfieldsf_insert_in_database.
   php” file. The corresponding line of code that generate the field to store would
   be:
 *     ```
       $field1 = mysqli_escape_string( $db_link, $params[ 'fieldname1' ] );
       ```
   
 * but you need to process this variable to convert it into a MySQL date time text:
 *     ```
       $field1 = strtotime($field1);
       $field1 = date("Y-m-d H:i:s", $field1);
       ```
   
 * At the end the `$field1` variable is ready to be used in the insertion query 
   to be stored in the database.
 * Best regards.
 *  Thread Starter [mads](https://wordpress.org/support/users/madstudio/)
 * (@madstudio)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/date-in-database/#post-9797667)
 * Hello,
    thank you so much. I think $field1 = strtotime($field1); $field1 = date(“
   Y-m-d H:i:s”, $field1); is what i need. I´ll try it. version: 10.0.301 best regards.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘date in database’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)

 * 2 replies
 * 2 participants
 * Last reply from: [mads](https://wordpress.org/support/users/madstudio/)
 * Last activity: [8 years, 5 months ago](https://wordpress.org/support/topic/date-in-database/#post-9797667)
 * Status: resolved