Is there a way to create a JSON object in PHP that contains a javascript date object? Does json_encode automatically convert PHP’s DateTime to Javascript’s date?
Is there a way to create a JSON object in PHP that contains a
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could pass the date / time as a UNIX timestamp which is an integer, a natively supported data type in JSON. DateTime in PHP has a “getTimestamp()” function which will give you that value.