Piyush Posted October 31, 2009 Report Share Posted October 31, 2009 (edited) how to get difference b/w a date of any format suppose YYYY-DD-MM HH:MM:SS and the current date with php.. Edited October 31, 2009 by Piyush Link to comment Share on other sites More sharing options...
Synook Posted October 31, 2009 Report Share Posted October 31, 2009 There are several ways to do it but I would just convert the time string into a timestamp using strtotime() and then subtract the two timestamps from each other. Link to comment Share on other sites More sharing options...
Piyush Posted November 1, 2009 Author Report Share Posted November 1, 2009 how to subtract it...simply by - operator or something else... Link to comment Share on other sites More sharing options...
Synook Posted November 1, 2009 Report Share Posted November 1, 2009 You have to use strtotime() to convert them into timestamps first, then since timestamps are just numbers you can subtract them normally. Link to comment Share on other sites More sharing options...
Piyush Posted November 1, 2009 Author Report Share Posted November 1, 2009 thanks for that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now