Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @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

    (@madstudio)

    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.