Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3397566
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:32:39+00:00 2026-05-18T04:32:39+00:00

I know there’s ample information about datetimes on the internet but I’m having trouble

  • 0

I know there’s ample information about datetimes on the internet but I’m having trouble using what I’ve been seeing.

I have a calander control hooked up to a text box. It takes it in the form 15/11/2010 (british). I use it to query datetime fields in a SQL server db in the format 15/11/2010 00:00:00.

After the capture the dates on postback I pass the values onto my method that attempts to convert the text into time format. When I query for something between 01/01/2010 and 01/07/2010 I get a number of results. When I change this to between 01/01/2010 and 30/10/2010 I get an error. The error is invalid foreach (haven’t caught the error yet). I’m guessing its something to do with my formats?

function getSupportTicketsbySubIssueAndDate($subissueid, $from, $to){

    $subissueid = $this->ms_escape_string($subissueid);

    $from = date("DD/MM/YY", strtotime($from));
    $to = date("DD/MM/YY", strtotime($to));

    $connection = new Connections();
    $conn = $connection->connectToWarehouse();
    $atid = $_SESSION['saveddata']['autotaskid'];


    $tsql = "SELECT wh_task.task_id, wh_task.task_name, wh_task.task_description, wh_task.task_number, wh_task.reported_by_name, wh_task.create_time, wh_resource.first_name, wh_resource.last_name, wh_task_status.task_status_name ".
            "FROM wh_task_status INNER JOIN (wh_task INNER JOIN wh_resource ON wh_task.assigned_resource_id = wh_resource.resource_id) ON wh_task_status.task_status_id = wh_task.task_status_id ".
            "WHERE (account_id = $atid) AND (subissue_type_id = $subissueid) AND (((wh_task.create_time) Between '$from' And '$to'))".
            "ORDER BY create_time DESC";


    // set up array to hold each of the issue types and the number of tickets in each
    $ticket;

    $stmt = sqlsrv_query( $conn, $tsql);
    if( $stmt === false)
    {
             echo "Error in query preparation/execution.\n";
             die( print_r( sqlsrv_errors(), true));
    }

    $x = 0;
    /* Retrieve each row as an associative array and display the results.*/
    while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
    {
            $ticket[$x][0] = $row['task_name'];
            $ticket[$x][1] = $row['task_description'];
            $ticket[$x][2] = $row['task_number'];
            $ticket[$x][3] = $row['reported_by_name'];
            $ticket[$x][4] = $row['first_name'];
            $ticket[$x][5] = $row['last_name'];
            $ticket[$x][6] = $row['task_status_name'];
            $ticket[$x][7] = $row['create_time'];
            $ticket[$x][8] = $row['task_id'];

            $x++;
    }

    return $ticket;
}

Any help most appreciated!

Jonesy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:32:40+00:00Added an answer on May 18, 2026 at 4:32 am

    I’m unsure if you’re formatting the dates correctly. You can find all the formatting rules at the bottom through the URL posted

    date("DD/MM/YY ...
    

    That’s not gonna work cause that’s not how they’re formatted in PHP. This:

    date("d/m/y ...
    

    will change the format to DD/MM/YY. 🙂

    http://php.net/manual/en/function.date.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there have been similar questions posted but I think the issue I'm
I know there have been a few threads on this before, but I have
I know there have been quite a few posts on this but none seem
I know there have been many questions on grid and pack in the past
I know there is a wiki page about it , but since I'm very
I know there are hundreds of questions about UTF-8 woes but I tried all
I know there are lots of stack overflow posts about this. I have this
I know there is a question about this subject already but I think it's
I know there are several topics out there about this, but none of them
I know there has been similar questions before, but I can't find a solution

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.