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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.