Jump to content

help regarding date function of php


dearmoawiz

Recommended Posts

hi guyz ..

  hwz u all i need ur help

                here is the scenario........

          i hav today date  with date function n i have another date which is save in database

like    09/05/2008 (today date)        and    12/04/2008  (date from database)        now i want to calculate the difference b/w these 2 dates in the form of days then how i calculate that

plz help me

                wizzz!!!!

Link to comment
https://forums.phpfreaks.com/topic/104830-help-regarding-date-function-of-php/
Share on other sites

You should store dates for functionality, not appearance. You can format on output to any format you want. Got it?

 

But, if you insist on a non-processable format that's as much use in a database as a chocolate teapot, then

 

Get date from database

Convert your d/m/y date to ISO

Now you can use strtotime() to convert to to unix timestamp.

Subtract from the the current time() value to get the difference in seconds

Divide that difference by 86400 to get days.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.