1

I have a php database that accepts user input. It accepts the built in grammar type which is date, is stores to the database the date in this format 20101030. I want to be able to check against the database for use within a grammar but it doesn't recognize this value again as a date. Is there anyway i can do this? thanks

aspiringCoder
  • 415
  • 1
  • 9
  • 24

1 Answers1

1

Try this

$datear=array();
        $temp=strtotime($row['Your_date_column']);
        $datear=getdate($temp);
        echo substr($datear["month"],0,3).'-'.$datear["mday"].'-'.$datear["year"];
  1. ($row['Your_date_column']) this will give the unix timestamp what you wrote above like 201010... getdate() function will convert to date array which will store relevant information like

    [seconds] - seconds [minutes] - minutes [hours] - hours [mday] - day of the month [wday] - day of the week [year] - year [yday] - day of the year [weekday] - name of the weekday [month] - name of the month

once you get this info try for format the date as you need in you database..

appdroid
  • 573
  • 7
  • 18
  • The issue with this is, when i want the to use the database details as a grammar, the user cannot specify a value such as august 21st, they have to say august twenty one, is there a way i can get vxml to interpret this as a date? – aspiringCoder Apr 11 '12 at 08:49