Jump to content

solidstan

Members
  • Posts

    10
  • Joined

  • Last visited

solidstan's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks, you make it sound easy. I was getting "23/2/14" which I assume was a string. I had tried so many different ways, I was convinced this was never going to work. I had tried the datetime() function, but could only get current date. Your Solution works perfectly. Thanks Millions. my code is procedural, the bit of Object O posted above was what I have copied from elsewhere. Thanks again, I now understand.. Solved!
  2. function customData($con,$num,$driverListDate,$rotaDate,$noOfLines,$line){ if($line==getNewLine($con,$num,$driverListDate,$rotaDate,$noOfLines)) { //echo date("M d, Y" ); //echo date('M d, Y', $rotaDate); $date = DateTime::createFromFormat('d/m/Y', $rotaDate); return $date; Think im gona have to give up with this stuff.
  3. Aghhh, my head is spinning. I'm sure this should be easy.Can anybody please SHOW ME, what I'm looking for.I'm really not getting this.Looked at loads of web pages, tried loads of ways. Nothing seems to work.
  4. function customData($con,$num,$driverListDate,$rotaDate,$noOfLines,$line){ if($line==getNewLine($con,$num,$driverListDate,$rotaDate,$noOfLines)) { //echo date("M d, Y" ); //echo date('M d, Y', $rotaDate); // return $rotaDate; $rotaDate = DateTime::createFromFormat('d/m/Y', $date1); echo $date1; echo $rotaDate; } } No, This does nothing!
  5. If anybody can go the extra mile, and give me a physical Example... Please do. If i knew how to do this.. I would'nt be asking!
  6. echo date_format($rotaDate, 'g:ia on l jS F Y'); I copyied this from the page you showed me, but AGAIN.. It Fails!
  7. Im sorry. Im new very new to php. Are you asking me if $rotaDate is a string? Im not sure, that is why I showed it here:- $rotaDate = date('23/2/14'); If I change this format in any shape or form, the that second function(which I copyed and pasted from the net) Fails! Right now, my php page works perfect, except for the format that it outputs.
  8. I have a working php file, which use lots of custom dates. I am try to simply format an echoed out put, with no success(very new to php). hope someone can help. $rotaDate = date('23/2/14');$driverListDate = date('5/1/14'); //Calculate the differance between 2 dates function dateDiffInWeeks($date1, $date2,$noOfLines){ $first = DateTime::createFromFormat('d/m/Y', $date1); $second = DateTime::createFromFormat('d/m/Y', $date2); return (((floor($first->diff($second)->days/7))/$noOfLines) - floor((floor($first->diff($second)->days/7))/$noOfLines))*$noOfLines; } function customData($con,$num,$driverListDate,$rotaDate,$noOfLines,$line){ if($line==getNewLine($con,$num,$driverListDate,$rotaDate,$noOfLines)) { //echo date("jS F Y" ); //echo date('jS F Y', $rotaDate); return $rotaDate; } } Im trying to echo my date as "jS F Y" format. This of course is not my full php file, but im sure its all thats relevant. Thanks in advance!
  9. These examples all seem to be returning arrays. (way above my head). I was hoping someone could show me a simple function to returm a SINGLE value and set that value as my varaible OUTPUT. My query will always only have 1 possible value. Note.. 1 SINGLE value. NOT a row of data.
  10. I am very new to PHP and SQL, and enjoying learning through W3School.I need alittle help with my function, to return a single value from a sql database. function lineData($con,$num,$row){ $Result = mysqli_query($con,"SELECT Line FROM DriverList WHERE DriverNumber = $num"); $output = mysql_query($Result); return $output } Hope you can see what i'm trying to do. Any help and tips, would be appreciated.. Thanks in advance!
×
×
  • Create New...