I have a field at a grid containing date/time and I need to know the difference between that and the current date/time. What could be the best way of doing so?
The dates are stored like "2011-02-07 15:13:06".
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.
This will give you the difference between two dates, in milliseconds
In your example, it’d be
You need to make sure that
compareDateis a validDateobject.Something like this will probably work for you
i.e. turning
"2011-02-07 15:13:06"intonew Date('2011/02/07 15:13:06'), which is a format theDateconstructor can comprehend.