January 18, 201511 yr Have a webpage where the date is required to be entered. The issue is it requires it in mm/dd order it seems. Any way to convert the dd/mm/yyyy while it sends to the database?
January 19, 201511 yr Under the hood, FileMaker always wants mm/dd/yyyy It may display it differently but... If the web form input is in dd/mm/yyyy (use a JavaScript date picker for this bit) then you can convert for input: $date_input = $_POST(date); $date_array = explode ("/"; $date_input); $date_toFM = $date_array[1]."/".$date_array[0]."/".$date_array[2]; And input the $date_toFM variable to the database I think that should work - been a while since I wrote code...
January 19, 201511 yr Author I hate to be a pain but where am I pasting that code? I assumed in the header of the search results page but I just get a blank white screen.
January 19, 201511 yr So I'll assume that you are doing a search on a date, from a search form... The above would need to be in the php section at the top, and before the actual search query, with the search query using the $date_toFM variable for the date part of it... If you paste your code for the search results page, I should be able to check it fairly quickly
January 20, 201511 yr Cool... try: <?php //Setup date to be in US format from AU format $date_input = $_REQUEST['Date_Start']; $date_array = explode ("/"; $date_input); $date_toFM = $date_array[1]."/".$date_array[0]."/".$date_array[2]; $search_bookings_results_find = $Marthakal->newFindCommand('Booking'); //Note Date_start is using the $date_toFM valye from above $search_bookings_results_findCriterions = array('Date_Start'=>$date_toFM,'Event_Resource'=>$_REQUEST['Event_Resource'],'triprecordnumber'=>$_REQUEST['triprecordnumber'],'payment_receipt no'=>$_REQUEST['payment_receipt_no'],'Status_Option'=>'=='.fmsEscape('Set As Paid'),'Pilot'=>$_REQUEST['Pilot'],); foreach($search_bookings_results_findCriterions as $key=>$value) { $search_bookings_results_find->AddFindCriterion($key,$value); } fmsSetPage($search_bookings_results_find,'search_bookings_results',50); $search_bookings_results_find->addSortRule('Date_Start',1,FILEMAKER_SORT_DESCEND); $search_bookings_results_result = $search_bookings_results_find->execute(); if(FileMaker::isError($search_bookings_results_result)) fmsTrapError($search_bookings_results_result,"searcherror.php"); fmsSetLastPage($search_bookings_results_result,'search_bookings_results',50); $search_bookings_results_row = current($search_bookings_results_result->getRecords()); $search_bookings_results__ClientBooking_portal = fmsRelatedRecord($search_bookings_results_row, 'Client_Booking'); $search_bookings_results__BookingClients_portal = fmsRelatedRecord($search_bookings_results_row, 'Booking_Clients'); $search_bookings_results__BookingManifest_portal = fmsRelatedRecord($search_bookings_results_row, 'Booking_Manifest'); // FMStudio Pro - do not remove comment, needed for DreamWeaver support ?>
January 20, 201511 yr Ah crud - spend too much time in straight FM scripting... Try: $date_array = explode ("/", $date_input); (comma in the middle, not semicolon)
January 20, 201511 yr Author Thank you so much. Worked perfectly. Definitely still learning how all this works :S
Create an account or sign in to comment