Welcome Guest, Not a member yet? Register   Sign In
help with time?
#11

[eluser]slowgary[/eluser]
strtotime() returns a timestamp. A timestamp can be converted to any format you want using PHP's date() function. php.net/date
#12

[eluser]newbie boy[/eluser]
works now...

thanks...
#13

[eluser]newbie boy[/eluser]
i need help with the date query...

how can i filter the date if falls to a 1 week duration, 3 weeks, and a month duration from the present time?

thanks guys...
#14

[eluser]slowgary[/eluser]
Huh? Filter? Query?

Please explain your needs again. More thoroughly this time.
#15

[eluser]Thorpe Obazee[/eluser]
Don't you need to create another topic for this?

Anyway, could you please explain the question better?
#16

[eluser]slowgary[/eluser]
bargainph, it's still technically "help with time?" related, although newbie boy seems to have a habit of not explaining himself clearly, as well as asking for help with things that are easily answered with a bit of searching - which is why he'll always be "newbie boy" and never "Veteran Man". ;-P

Edit: Sorry newbie boy, this was not meant to discourage you or even deter you from rephrasing your problem. I was just doing a bit of ragging, I didn't really mean anything by it. I actually look forward to knowing what the problem is so that I can post a suggestion.
#17

[eluser]Thorpe Obazee[/eluser]
Yeah, I agree it's a 'help with time' problem.. but it will be difficult for another person to search the forums if he/she is particularly looking for this 'new' topic which I think is a database/timestamp problem.
#18

[eluser]slowgary[/eluser]
I think I got it!! I actually read your post a little more carefully and I think I realize what you're asking. You have a date field in your database table, and you want to get a result set where the date field is within a certain timeframe from today.

You really should start using a search engine to find your answers, as this should be a fairly common problem that is likely answered a million times over on the internet. You could probably do something like this:
Code:
SELECT * FROM `table` WHERE `date_field` < NOW() + 86400
You'd want to replace the '86400' with the number of seconds in your offset. 86400 seconds is equal to one day.
#19

[eluser]newbie boy[/eluser]
it's like this...

every time a user bought something on my site, i save the actual date into my database...

what i need to do now, is to filter the all the things that a user had bought by the date...

if that things had bought within this week, past 3 weeks, and a month from now...


sorry for the stupidity guys but i really appreciate all the help...
#20

[eluser]Thorpe Obazee[/eluser]
Google search:

3 weeks = 1 814 400 seconds
1 week = 604 800 seconds
1 month = 2 629 744 seconds

SELECT * FROM `table` WHERE `date_field` > (NOW() - [insert_seconds_here]) (for logic purposes only)




Theme © iAndrew 2016 - Forum software by © MyBB