The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Date and Time Variables
OK .. having a bit of a problem here figuring out what Date and Time variables are availlable. Would appreciate any help!
Firstly, what I'm looking to do, is be able to use an if/else statement to do/show something dependant on if the 'forum time' falls into a certain range (BETWEEN $feature_open AND $feature_close). Is there a variable that is accessable for your forum's time? By forum time, I mean server time + $vboptions[hourdiff] (which is the variable I found for server to forum offset). Or would I be better off adding the following in global.php if it's a variable I'll be using alot? PHP Code:
I'm very new to this and still learning the basics of PHP, but am I correct in assuming date() is the php function to get the unix time on your forum's server? I'm guessing since I'll be using it for both comparisons and display, that it would be best to keep it in unix time (seconds since 1970), and then later just format it for display purposes? Is this the IF statement I should use? PHP Code:
Code:
$features = however_connect_to_table_then_add_SQL_ SELECT needed_data1, needed_data2 FROM feature_data_and_date_range_table WHERE (getdate() BETWEEN feature_open AND feature_close) AND feature_id = $feature_to_get_if_in_range; Do vB variables have 'scope' (learning new terms .. lol) within SQL statements in vB PHP pages? Also, when wanting to enter the date range to my database to store the range something will be availlable, should I use the following if I used the coresponding form variable on the submit page? $feature_open = mktime(open_hour,0,0,open_month,open_day,open_year ); and $feature_close = mktime(close_hour,0,0,close_month,close_day,close_ year); I'm still not sure how to plug it all into the appropriate database fields, but I'm sure some searching in these and/or other MySQL forums will help, or simply looking at similar code already in vB. Otherwise I 'll start a new topic not to mix it up with this one. THANKS TO ANY AND ALL WHO EVEN TRY TO READ THE ABOVE MESS !!! LOL |
#2
|
||||
|
||||
Questions about modifying vBulletin's default behaviour and asking about modifications in general, should be posted in General vBulletin Questions. Please read the forum descriptions more carefully in future. I've moved your thread there for you
Thanks, - Dean |
#3
|
|||
|
|||
OK cool ... thanks ... ... Thought it was more of a modification at the time, but now I guess it's more of a "How Do I?" ... lol
Anyhow ... anyone have any feedback or comments for me ??? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|