Jump to content

Newb date question


redneonrt

Recommended Posts

[!--quoteo(post=381608:date=Jun 8 2006, 04:29 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 8 2006, 04:29 PM) [snapback]381608[/snapback][/div][div class=\'quotemain\'][!--quotec--]
It depends... What is the format of the inserted timestamp?
[/quote]

when I insert a date, strtotime

example $date = strtotime("06/07/2006");
Link to comment
https://forums.phpfreaks.com/topic/11523-newb-date-question/#findComment-43400
Share on other sites

OK, that means it's using an UNIX timestamp.

You can use the following query:
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]table[/color] [color=green]WHERE[/color] EXTRACT(MONTH [color=green]FROM[/color] [color=orange]FROM_UNIXTIME(date))[/color] [color=orange]=[/color] month_here [!--sql2--][/div][!--sql3--]

Now, I usually would use PHP to get this. But I'm following Barand so I'll use the least PHP possible. I hope it's a good thing [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
https://forums.phpfreaks.com/topic/11523-newb-date-question/#findComment-43402
Share on other sites

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]`ext`[/color] [color=green]WHERE[/color] EXTRACT(MONTH [color=green]FROM[/color] [color=orange]FROM_UNIXTIME(date))[/color] [color=orange]=[/color] 6 [!--sql2--][/div][!--sql3--]

You missed a FROM...
Link to comment
https://forums.phpfreaks.com/topic/11523-newb-date-question/#findComment-43702
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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