/    Sign up×
Community /Pin to ProfileBookmark

I beg you oh PHP lords :)

Hi!

In the past few years I’m getting better and better at PHP programming, and I feel I can do alot with it now. I haven’t learnt it in school, but by myself.

I’m now working on a project I started. A database based stuff for our family business, a video library. It can do alot now, and I worked quite hard on it. And I’ve arrived to a difficult piece.

I have to count the money for the movies which are arrived back late to us. And I have to count the days of the expired lendings, so I’mhaving a though time.

I save the lending date and in a mysql table (5 colums year, month, day, hour and minutes)…

I need to count that how many days have passed since the particular date I’ve stored in the database. And I’m having a hard time count which moinths have 30 or 31 days or when february has 28 or 29.

I’m asking you if there is any piece of code or a function in php or maybe javascript which can count the days from a certain date to another (which will mostly be the present date and time).

I hope someone could help me with that. And Please forgive me for my bad english!

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@roscorDec 01.2007 — Google [U]php time between dates[/U] here is one result

[URL]http://www.michaelhorowitz.com/php/datediff.php[/URL]
Copy linkTweet thisAlerts:
@MrCoderDec 02.2007 — Why have 5 columns (fields) for the date when you could just use a mysql date field?
Copy linkTweet thisAlerts:
@jasonahouleDec 03.2007 — I would definitely use a single timestamp or date column and convert that to milliseconds. Then it is simply a matter of subtracting the borrowed timestamp from the current timestamp.
Copy linkTweet thisAlerts:
@hegerpauthorDec 03.2007 — Thank you everyone. I've found some stuff on Google that helped me. So...

Thanks the lot!
×

Success!

Help @hegerp spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...