-
calculating dates in PHP
how i can calculates dates n ages in PHP
my all dates are stores in database as unix timestamp..
is there any predefined functions which can b used to calculate dates ? i.e.
i did some activity on 12-01-10 and on 12-02-10 it l show me that 1 month gone for this activity etc?
thanks in advanced...
-
-
-
-
http://www.php.net/manual/en/function.strtotime.php
http://www.php.net/manual/en/function.date.php
Input a formatted date(s) and convert to a timestamp using strtotime() or a similar function.
Then do math on the date(s) and use date() to format as needed.
There is no "default" way to do this, but depending on your needs, you can put together a combination of a few functions to accomplish any necessary math.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
wel thanks...
i already done like this.. but i was looking for some better methods...\
-
-
The only better method would be to write a function for yourself that automates the process, using those functions as the base.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks