Hi,

I have been using some tools to generate my php code as i have little knowledge of php.

the tools are ok but the support is rubbish.

everything is generated in US date and time format and i need it to be in UK.

anyway to cut a long story short they want me to modify the code their tools create however i have no knowledge and i go around in circles with them time wasting when i just need to get around this.

this is what they have came back to me with:

//add a comparison argument from an edit box
function addComparisonFromEdit($Column,$EditName,$Logical,$Comparison,$FieldType) {
$theValue = WA_DBS_PostOrGetField($EditName);
if (isset($theValue) && $theValue != "undefined" && $theValue != "") {
$this->addComparison($Column,$theValue,$Logical,$Comparison,$FieldType);
}
}

The WA_DBS_PostOrGetField($EditName); is what gets the date. If you reformat the date from the UK format to the correct search format, you should get the correct start date search.

On your results page, there should be some code that looks like this:
//comparison list additions
$WADbSearch1->addComparisonFromEdit("HistoryDate","begdate","AND",">=",2);
$WADbSearch1->addComparison("HistoryDate","".WAQB_getEndDate($_POST["enddate"]) ."","AND","<=",2);

with different form field names (I used begdate and enddate) and also different column names (I used HistoryDate). To get the end date to search correctly, you will want to format the $_POST["enddate"] to the correct search format from your UK value.

i need to modify this using a string function into uk format however i do not know how i would write this and where it woudl go in the code he has told me to modify?

could someone with PHP knowledge help tell me where i would add the string function to the code as i do not know where it would go?

i think i add gmdate by looking on php.net but i am not sure and not sure where to add.

thank you all for your great help.

This forum is great.

just wish the company i am dealing with who i pay to use their product were better.(little moan, sorry)

many thanks

Recommended Answers

All 3 Replies

Try adding this in at the start of the code. However, where it says "Australia/Melbourne" change that to your timezone.

Supported ones can be found here: http://au2.php.net/manual/en/timezones.php date_default_timezone_set('Australia/Melbourne'); hope it helps

Thanks for the help, i added this however i get an error:

Fatal error: Call to undefined function: date_default_timezone_set()

I added in

date_default_timezone_set('Europe/London');

at the start but no luck.

could you help please?

many thanks

post the code , the real problem is easier to fix, than someones explanation of the problem

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.