You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Difference of 1 day when storing value in "Date" field

Received Response
edited Oct 10, 2018 7:28AM in Customer Portal 13 comments


I'm trying to store a DoB value in a custom object field that is of type "Date". But there seems to be a difference of 1 day when the value is saved in the object. The code I'm using is:

$dob = "23/08/1965"; // this value is coming from the form
list($d, $m, $y) = explode("/", $dob);
$to_store_dob = $y."-".$m."-".$d;

$contact = new RNCPHP\Contact();
$contact->CustomFields->CO->Date_of_Birth = strtotime($to_store_dob);

When I checked the value, it gets stored as "1965-08-22". This could be a timezone issue but I'm not sure how to use the correct timezone in the code. When I looked at the console taskbar, this is what I found out:

Howdy, Stranger!

Log In

To view full details, sign in.


Don't have an account? Click here to get started!