This is a discussion on "Some advaced stuff (I think)" within the PHP Forum section. This forum, and the thread "Some advaced stuff (I think) are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Some advaced stuff (I think)
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Some advaced stuff (I think)
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! |
|
|
|
||||
|
Re: Some advaced stuff (I think)
date('t',[timestamp]) returns the number of days in a month.
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
|||
|
Re: Some advaced stuff (I think)
I will definately use that one. Thank you very much.
But I'm trying to find an easier way... For example: I define a date(y-m-d h:m) I don't know exactléy how it is done but I'll manage. Then I will define another day: for example the current date(), and I need a function or something that counts days months and maybe hour between the two dates. I don't know if such function or script exists... |
|
||||
|
Re: Some advaced stuff (I think)
How about writing it yourself... not at all hard...
1. convert the two dates into unix timestamps (time() function). 2. subtract timestamp1 from timestamp2. 3. convert to seconds into months/days/hours/min/sec. Here's a function I wrote for converting seconds (only hours/mins/secs):
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| what are this stuff? | geyids | Web Page Design | 2 | Aug 7th, 2007 17:17 |