This topic is locked
[SOLVED]

 Date Format In Email

1/29/2016 7:01:43 PM
PHPRunner General questions
lefty author

I use PHPrunner 8.0 . I also use templated emails for after record edited events. I can't seem to get the format right in php . I have done it with templated emails in asp but having problems with php. See sample below flddate need format for sending email have tried str_format_datetimeto no avail , as it shows european format. Also see flddate_start and fldate_end for TIME also shows military time instead of 12 hour time . Have tried str_format_time for that to no avail. The MYsql database I changed flddate to just DATE. Any ideas here? It all looks good on website . Just not when I send the form.
//*Start Email Form ***

// load email template

$email_message = file_get_contents("event_compliance_form.htm");

// replace variables

$email_message = str_replace("##flddate##",XXXXXXXXXX__$values["flddate"],$email_message); //This is stored event ( Today )

$email_message = str_replace("##fldname##",$values["Employee"],$email_message);

$email_message = str_replace("##fldsales_num##",$values["EmployeeID"],$email_message);

$email_message = str_replace("##fldcust##",$values["custname"],$email_message);

$email_message = str_replace("##flddate_event##",XXXXXXXXX$values["flddate_event"],$email_message); // This is stored event ( event date )

$email_message = str_replace("##flddate_start##",XXXXXXXXXXX$values["flddate_start"],$email_message); // This is Start Time

$email_message = str_replace("##flddate_end##",XXXXXXXXXXXXX$values["flddate_end"],$email_message); // This is end Time
// Obiviously the XXXXXXXX stand for where the strdatetime function is just haven't been able to get to work. Thanks for your help in advance.
// send HTML email

$email=$values["fldadminemail"];
$subject="Event Compliance Request";
$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $email_message, 'charset' => 'UTF-8'));
// if error happened print a message on the web page

lefty author 1/31/2016

This worked . Was missing strtotime
$email_message = str_replace("##fldgoing##",date("m/d/Y",strtotime($values["fldgoing"])),$email_message);

$email_message = str_replace("##orderdate##",date("m/d/Y",strtotime($values["orderdate"])),$email_message);