Is it possible to include the micro seconds when serializing a Rails object for ‘datetime’ fields? For example:
{
"created_at":"2011-05-27T19:49:43.123456Z",
"updated_at":"2011-05-27T19:49:43.654321Z",
"..."
}
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 need to override the default JSON formatting which is set in this file.
The format that you want to use would be this
And you can patch JSON’s DateTime output like this
And here is a reference of the fractional time references available in strftime()
%N – Fractional seconds digits, default is 9 digits (nanosecond)