|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
mysql datetime + mktime();
ok,....I am using a datetime field in mysql so that I can do date comparisons via sql syntax.
however, when I try to pass that mysql field to date(); I get. Wed, December 31, 1969 @ 7 pm so,....I pass my mysql field into mktime() PHP Code:
then my date displays correctly. now the question...lol I like storing my dates as datetime fields so I can compare via sql, but this extra step through mktime(); is killing me. is there another way to do this?
__________________
-- Jason |
|
#2
|
|||
|
|||
|
Not that I know of. Is this really such a big deal? You write the code once in a function and you never have to look at it again.
|
|
#3
|
|||
|
|||
|
well for large queries it can be,.... I mean,...I am doing 1 comparison in sql, then have to pass it through mktime();,....so,...yes and no i guess,....just looking for options is all
|
|
#4
|
|||
|
|||
|
You will find that for many reasons you will have to convert your date. I won't go into detail right now as the subject can get quite complex, but just know that this is the case.
Its really not that intese to run a function over your date field, and there really isn't a "better" way to do it IMHO; however, if you want you to can use the database function: UNIX_TIMESTAMP(). This is a mysql function, so do expect that it is portable to another DB Engine. Its possible, but not likely. Just make sure you test across ports before use.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. Last edited by laidbak : June 30th, 2003 at 03:50 PM. |
|
#5
|
|||
|
|||
|
gotcha,....ohh and I got that date time select class working great now. POST info stays saved in the form in case of errors as well
![]() |
|
#6
|
|||
|
|||
|
Cool... post an example.
|
|
#7
|
|||
|
|||
|
there is not much different then the previous, there are a few changes though. an if else statement is in there in case the form has been posted. just posting 1 of the functions here.
PHP Code:
usage PHP Code:
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql datetime + mktime(); |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|