#1
  1. No Profile Picture
    Aji
    Banned
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Mar 2004
    Location
    Kolkata, India
    Posts
    18
    Rep Power
    0

    Unhappy A php- mysql problem- date formats problem


    Hi all,

    I have a simple problem, I tried it but getting error, still trying to solve but thought will get the help from some experts too.

    Database(mysql) date format :yyyy-mm-dd 00:00:00
    client site query date is : dd/mm/yyyy

    I have seprated the client side date into different portions like (dd) and (mm) and (yyyy). I can get them

    My problems
    ------------------
    (1) I want to query between two dates say 21/04/2004 to 23/04/2004 , how to do that ??
    (2) I want yyyy-mm-dd 00:00:00 , to seprate month , date , year , time from this format using php, how can I do that, I know its easy but I am not an expert on php and mysql.

    I am using the following query, but the problem is with the date format ,
    $sql1="select * from TblUsers1,TblUserInfo1 where TblUserInfo1.FldUserID=TblUsers1.FldUserID and (TblUsers1.FldDateSubscribed BETWEEN '$StartDate' AND '$EndDate')";


    HELP HELP HELP

    Thank
    Aji
  2. #2
  3. No Profile Picture
    Registered User
    SEO Chat Explorer (0 - 99 posts)

    Join Date
    Apr 2004
    Location
    USA
    Posts
    9
    Rep Power
    0
    Originally Posted by Aji
    Hi all,

    My problems
    ------------------
    (1) I want to query between two dates say 21/04/2004 to 23/04/2004 , how to do that ??
    (2) I want yyyy-mm-dd 00:00:00 , to seprate month , date , year , time from this format using php, how can I do that, I know its easy but I am not an expert on php and mysql.

    Aji
    $datetime = "yyyy-mm-dd 00:00:00"
    $date_only = explode(" ",$datetime);
    //$date_only[0] holds the date "yyyy-mm-dd"

    if you need to actually break the date apart simply explode again
    $_tmp = explode("-",$date_only[0]);
    $year = $_tmp[0];
    $month = $_tmp[1];
    $day = $_tmp[2];

    http://us4.php.net/manual/en/function.explode.php

Similar Threads

  1. Advanced search PHP and MySQL problem
    By bbratu in forum Web Design, Coding and Programming
    Replies: 3
    Last Post: Oct 26th, 2010, 07:28 PM
  2. Godaddy problem and poor customer support
    By tonyfelice in forum Google Optimization
    Replies: 46
    Last Post: Sep 19th, 2004, 03:17 AM
  3. A php- mysql problem- date formats problem
    By Aji in forum Web Design, Coding and Programming
    Replies: 4
    Last Post: May 6th, 2004, 09:13 PM
  4. Google API Problem - PHP
    By JRM in forum Web Design, Coding and Programming
    Replies: 4
    Last Post: Sep 30th, 2003, 10:22 AM

IMN logo majestic logo threadwatch logo seochat tools logo