Note that there are some explanatory texts on larger screens.

plurals
  1. POSyntax error converting datetime from character string when using Java Date Picker
    primarykey
    data
    text
    <p>I am trying to do a query into a database to return a report with php. I am using duplicate pages as they both are pulling from the same database/tables. </p> <p>The specific error I receive is: </p> <p>Msg 241, Level 16, State 1, Line 1 Syntax error converting datetime from character string.</p> <p>This query works and returns the desired data:</p> <p><strong>REMOVED SELECT STATEMENT PER COMPANY POLICY</strong></p> <p>This query however, does not work:</p> <p><strong>REMOVED SELECT STATEMENT PER COMPANY POLICY</strong></p> <p>I changed the DateUpdated to DateAdded in the cast portion. The Date/Time are obtained from a Java date picker script. Everything on the two pages are exact, except for the sql query. Does anyone have any idea what could be the problem? I am fairly new to PHP and so I am learning as I go.</p> <p>I have tried searching but I do not understand what I should do.</p> <p>I have these declared from the picker....</p> <pre><code>$startunix = date("Y-m-d H:i:s", strtotime($startdate)); $startunixmn = date("Y-m-d 23:59:59", strtotime($startdate)); $endunix = date("Y-m-d H:i:s", strtotime($enddate)); $endunixmn = date("Y-m-d 23:59:59", strtotime($enddate)); </code></pre> <p>and within the sql query, in place of the dates/times that are showing in the statement, they have $startunix and $endunixm for the two dates/times. Are you not allowed to change what is in the cast? I thought you would be able to, because both columns are dates in the format 010109 (mmddyy). SO I figured if you change the DateUpdated to DateAdded (titles of the two columns) then the query should work, just based off of the date range selected for DateAdded instead of DateUpdated.</p> <p>Any help or insight would be hugely appreciated. If you need more info, please ask and I will do my best to provide what I can.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload