Unable to insert current time from PHP

Hi: how do I insert the current time into a DATE field in the database. This is what I have and does not work.<br><br>
$currTime = 'to_date('.date("m/d/Y H:i:s", time()).', "MM/dd/yyyy HH:mm:ss")';<br>
$sql = 'insert into IMPACT_EMAIL_ACTION (PRIORITYID,OSFILTER,EMAILADDRESS,CREATEBY,ACTIONEXPIRE,STOPPROCESSING,REQUESTDATE) VALUES (:priority,:osrule,:eaddress,:createby,:expire,:stopprocessing,:reqtime)';<br>
$insertcusror = oci_parse($conn, $sql);<br>
.<br>
.<br>
oci_bind_by_name($insertcusror, ':reqtime', $currTime);<br>
.<br>
.<br>
$ok = oci_execute($insertcusror);<br>
<br>
I get the following error with the above code.<br>
oci_execute() [function.oci-execute]: ORA-01841: (full) year must be between -4713 and +9999, and not be 0 in /export/home/rawlog/lsws/DEFAULT/html/action.php on line 488<br>
In my log file when I print $currTime, this is what I see<br>
[STDERR] to_char(02/14/2007 10:05:15, "MM/dd/yyyy HH:mm:ss")<br>
<br><br>
Thanks<br>
Ravi<br>

had to use
$currTime = date("m/d/Y H:i:s", time());
$sql = 'insert into ' . $tableName . ' (PRIORITYID,OSFILTER,EMAILADDRESS,CREATEBY,ACTIONEXPIRE,STOPPROCESSING,REQUESTDATE) ';
$sql .= "VALUES (:priority,:osrule,:eaddress,:createby,:expire,:stopprocessing,TO_DATE('$currTime', 'mm/dd/yyyy HH24:MI:SS'))";
couldn't bind it...

Similar Messages

  • Need to find our current time from sqlplus

    I need to find out current time from sqlplus.

    select sysdate from dual;
    Hmmm ... time to hit the manuals?!?!

  • Insert current time

    How to insert current date and time in a table. i tried it as:
    1) Create table tt ( dt date );
    2) insert into tt values(to_date(sysdate,'DD-MON-YY hh:mi:ss am');
    3) select * from tt;
    then it shows as
    27-FEB-06 12:00:00 AM
    ---- but current time was 8:37:33 AM, please solve how to insert current time

    Hello,
    Which version you are using ? Here is what i performed on 9.2.0.1.0 :
    SQL> alter session set nls_date_format = 'dd-mon-yy hh12:mi:ss';
    Session altered.
    SQL> insert into test values (sysdate);
    1 row created.
    SQL> insert into test values (to_date(sysdate,'dd-mon-yy hh12:mi:ss'));
    1 row created.
    SQL> insert into test values (sysdate);
    1 row created.
    SQL> select * from test;
    ID
    27-feb-06 11:26:06
    27-feb-06 11:26:11
    27-feb-06 11:26:18
    SQL> insert into test values (sysdate);
    1 row created.
    SQL> select * from test;
    ID
    27-feb-06 11:26:06
    27-feb-06 11:26:11
    27-feb-06 11:26:18
    27-feb-06 11:26:29

  • Unable to insert into mysql from flash burrito

    I'm having issues inserting a record to mysql, if I use the test "test operation and use these values the it works fine, but now in the android app.
    values in my test operation
        id:0,
        type:"cool",
        navn:"vegar 16"
    the getall method works fine, and shows up on the network monitor, but the button dont work at all, nothing happends in the network monito, if I debug it I can see that the button works, any suggestions on what Im doing wrong?
    code in my view:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:kunderservice="services.kunderservice.*"
            title="Home">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import valueObjects.Kunder;
                protected function list_creationCompleteHandler(event:FlexEvent):void
                    getAllKunderResult.token = kunderService.getAllKunder();
                protected function button_clickHandler(event:MouseEvent):void
                    var item:Kunder = new Kunder();
                    item.id=0
                    item.navn="vegar"
                    item.type ="test"
                    createKunderResult2.token = kunderService.createKunder(item);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="getAllKunderResult"/>
            <kunderservice:KunderService id="kunderService"/>
            <s:CallResponder id="createKunderResult2"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:List id="list" x="35" y="45" width="409" height="193"
                creationComplete="list_creationCompleteHandler(event)" labelField="navn">
            <s:AsyncListView list="{getAllKunderResult.lastResult}"/>
        </s:List>
        <s:Button id="button" x="20" y="406" label="Button" click="button_clickHandler(event)"/>
        </s:View>

    I really appreciate your help. Yes indeed, debugging and seeing what is going on in general is most difficult with flash!
    Once I get this cracked I should be able to complete a lot of what I am trying to achieve.
    After inserting some echo's into my php as such:
    <?php
    $player = $_POST['player'];
    $tournament = $_POST['tournament'];
    $position = $_POST['position'];
    $prize = $_POST['prize'];
    mysql_connect("localhost", "root","poker");
    echo "onnected to database"
    mysql_select_db("poker");
    echo "database connected";
    mysql_query("INSERT INTO results(player,tournament,position,prize) VALUES
    ('$player','$tournamnet','$position','$prize')");
    echo "result added";
    ?>
    The returned info is a load of nonsense to me:
    response from server:  %3C%3Fphp%0A%24player%20=%20%24%5FPOST%5B%27player%27%5D%3B%0A%24tournament%20%3D%20%24%5 FPOST%5B%27tournament%27%5D%3B%0A%24position%20%3D%20%24%5FPOST%5B%27position%27%5D%3B%0A% 24prize%20%3D%20%24%5FPOST%5B%27prize%27%5D%3B%0A%0Amysql%5Fconnect%28%22localhost%22%2C%2 0%22root%22%2C%22poker%22%29%3B%0Aecho%20%22onnected%20to%20database%22%0Amysql%5Fselect%5 Fdb%28%22poker%22%29%3B%0Aecho%20%22database%20connected%22%3B%0Amysql%5Fquery%28%22INSERT %20INTO%20results%28player%2Ctournament%2Cposition%2Cprize%29%20VALUES%20%0A%28%27%24playe r%27%2C%27%24tournamnet%27%2C%27%24position%27%2C%27%24prize%27%29%22%29%3B%0Aecho%20%22re sult%20added%22%3B%0A%3F%3E

  • Unable to copy current-config from IPS 4240 to FTP server

    I am in the process of upgrading our Signature File at a client site where there is a 4240 installed.
    The readme file for Signature S353 indicates that a copy of the running configuration should be saved away.
    I have FTP running on my desktop.
    I am entering the following command on the IPS at CLI:
    bhiips# copy current-config ftp://192.168.5.189
    where I am then prompted for my username, then filename, then password.
    I watch as the IPS indicates "Generating current config".
    The log output of the FTP (Filezilla) shows my FTP connection successful, but then it bombs. Here is an excerpt:
    00151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> Connected, sending welcome message...
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> 220-FileZilla Server version 0.9.24 beta
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> 220-written by Tim Kosse ([email protected])
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> 220 Please visit http://sourceforge.net/projects/filezilla/
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> USER Kevin
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> 331 Password required for kevin
    (000151) 08/27/2008 15:45:47 PM - (not logged in) (192.168.10.53)> PASS ***
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> 230 Logged on
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> PWD
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> 257 "/" is current directory.
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> EPSV
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> 229 Entering Extended Passive Mode (|||2125|)
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> TYPE I
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> 200 Type set to I
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> STOR current
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> 550 Permission denied
    (000151) 08/27/2008 15:45:47 PM - kevin (192.168.10.53)> disconnected.
    What could be the problem here? I checked the Windows Firewall on my workstation at 192.168.5.189,but it is turned off. I am not sure why I cant save the config away.
    It is holding me up from moving forward with the upgrade to Sig 353.
    thx

    Have you checked permissions on your FTP server to see if a client is able to PUT a file onto your FTP server.
    Try connecting from a separate windows PC to your FTP server and login with the userid and password you are using in your copy command. And then try to push a file with a similar name on to your FTP server.
    It could be that the FTP server is not configured to allow that userid to put a file on the server.
    When you try the above test try and use an FTP client that supports Passive mode. There might be a problem with passive mode on your FTP server.
    You might also try running another test from the sensor, but this time instead of copying the configuration try copying the license file from the sensor to your ftp server.

  • Inserting current time and date in a form

    Feel silly here, but I can't seem to find a way to insert form fields that will display currnet time and date, I see where it can be done for a digital signature, but that's not what I need. This is for a client sign in sheet. I want to know what date and time the form is printed, without having to manually enter that data. Thanks.

    Actualy, looking around the web I found another Adobe forum where you answered another person's question about using a check box to populate a text field with the date, which is actually what I really need, as I want to be able to print the form with or without the date and time appearing. Here's the script you posted:
    // Mouse up script for check box
    {function () {
         // Get a reference to the text field
         var f = getField ("text");
         // Set the value of the text field
         if (event.target.value !== "off") {
              f.value = util.printd("mm/dd/yyy", newDate ());
              } else {
                    f.value = " ";
    I copied and pasted the code straight into the mouse up event for the check box, and then changed the text box name to the actuall name of the date text field, and the error I get is "too much recursion".

  • How do I insert the date to be continuous but not have the current time inserted using the NOW Formula?

    I am using the NOW formula to have the current dated inserted when ever I open my sheet, but I can not figure out how to keep the current time from also being added.

    Thank you, but I tried that.  This cell formating seems to only work when the cell contains only the formula.  I have text included in my formula, so the formating does not allow for it. It reverts to the default and as you see it wont even let you change the date format.

  • How can I build a table with the time values of a timer from a while loop

    Hi:
    I have a question concerning building a table:
    Every 100ms I read a value from a sensor (while loop with a timer). I would like to build a table with the actual time and the concerning value. For example:
    0msec         1V
    100msec     2V
    200msec     3V
    300msec     4V
    etc.
    If I use the Express VI for building a table, I always get the date and time, but I don't need the date and the time is in the following format: HH:MMS, which is nonsensical for me as I can't differentiate within msec. Can I change the format anywhere?
    Can I also save the table to a file or even to an Excelsheet? How can I do that?
    Thanks for your help!

    Hi Craig:
    thank you very much. To solve the mystery : ) :
    I want to drive a stepper motor with a specific frequency. To get the current degree value of the motor I would like to measure the current time (from the beginning of the move on). (With a formula I get the degree value out of the time)
    Concurrently I would like to get data from a torque sensor and from a pressure sensor. That's why I asked you about the time and the table. The measurement should start with the movement of the motor. How can I do that? Right now I have different block diagrams (different while loops) (see attachment) and I would like to put them in one.
    I haven't done the block diagram for the pressure sensor yet, so there is only the one for the torque sensor and the one for the motor.
    I also would like to set a mark in the table when the voltage value of an analog input gets under a specific threshold value. Is that possible?
    I'm sorry, I'm a novice in LabVIEW. But maybe you can help me.
    Thank you very much!
    Steffi
    Attachments:
    motor.vi ‏238 KB
    sensor.vi ‏59 KB

  • CR4E Unable to Insert Table (or Drag and Drop)

    <p>Please Help. </p><p>Using Release 11.8, I am unable to insert a table from te DBBrowser (aka MyEclipse DataBase Explore) onto an existing Crystal Report.  I can select and drag a table easily, but I&#39;m prevented from dropping it onto the Crystal Report (at the Data Tab).  Also, the DBBrowser does not have an Insert Table option in the context menu.</p><p>Thank you,</p><p>Ron  -- <a href="mailto:[email protected]">[email protected]</a></p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p><p>&#160;</p>

    Hi Ron
    We havent done any testing of CR4Eclipse with MyEclipse. Could you try and see if everything works OK on a standalone version or if you get the same problem.Â
    Thanks and welcome to Diamond

  • Insert Object (create from pdf file) in wordpad fails

    Problem:
    I am unable to insert object (create from existing pdf file) in wordpad application.
    Environment:
    OS: Windows 7 Professional + SP1 (64-bit)
    Acrobat X (32-bit installer)
    Procedure:
    Open Wordpad application, click on 'Insert Object', choose 'Create from File', Browse and Select exsting pdf file, click 'Display As Icon' and Click 'Ok'
    Expexted Result:
    PDF should get inserted as OLE object to wordpad
    Actual Result:
    Error message "Failed to create object. Make sure the application is entered in the system registry."
    Addition Notes:
    I noticed that while insterting PDF (OLE object) it seach for certain registry key (AutoConvertTo) which is not available hence it fails.

    Yes, I am aware. But this problem appears only when I insert PDF file (which is Adobe file).
    I guess this has nothing to do specifically with 'wordpad' but I referenced known application from standard offiering. It happens with any 64-bit application using 'rich-edit' control (this is Microsoft too ) and allowing user to insert OLE objects.
    I guess somewhere Adobe Acrobat installation fails to create required registry entries which are being referred by 64-bit applications while inserting PDF files as OLE objects.

  • How do I create a time field that's export value is 3 hours ahead of the current time?

    I need to create a field on one of our forms that takes the current time from another field and adds 3 hours to it. The JavaScript to pull the current time is:
    var tm = this.getField("Time");
    if(tm.value == '' || tm == ' ') tm.value =
    util.printd("HH:MM tt",new Date());

    Does your posted script work as expected?
    It does not fill-in the field for me.
    Is that code to get the time from a field or set the time for a field?
    Is the field you are trying to update?
    A time string for a computation is very limited or error prone unless it includes the date. There are many locations in the world that still observe Day Light Savings Time or Summer/Winter time and the time either moves forward one hour or falls back one hour at a certain date and time as prescribed by national or local law. So if one want to add 3 hours 1 hour before the time sift for the spring that would be 11:00pm adding 3 hours would result in a time value of 3:00 am the next day and not 2:00 am the next day. The hour between 1:00 am and 2:00 am does not exist for the local time zone.

  • Updating Time from NIST to Pacific Daylight Time

    I'm a newbie to Java and I'm trying to finish my final project in my Java class.
    Our project consists of setting up an ODBC and downloading data from a website and saving it to a text file that includes the current time from NIST.
    The specs ask for:
    Obtain the current exact time from the NIST (National Institute of Standards and Technology) by decoding the time from this web page or this web page and subtract 7 hours from it.
    b.     Open a sequential file and call it "APRYYMMDD.txt" where YY is year, MM is month, DD is the current day.
    c.     Write the first record as the exact time UTC obtained above.
    d.     Write the second record as the exact time obtained above minus 7 hours and formatted as "MM/dd/yyy kk:mm " (see SimpleDateFormat class).
    Which I have done, but my problem is coming forth when I write the code to update the time. When I subtract 7:00 hours from the GMT, the time is off by two hours, when I subtract 14:00 it is correct.
    If anyone can help me, there are Duke dollars available.
    Here is my code:
    � public static void Phase3(String mstrODBC, String mstrTable)
    ��� {
    ������� RandomAccessFile raf = null;
    ������� java.util.Date CurDate = null;
    ������� String Curtime = inetBank.getURL("http://128.138.140.44:13/");
    ������� SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd hh:mm:ss");
    ������� String AvgApr = null;

    ������� SimpleDateFormat pf = new SimpleDateFormat("MM/dd/yyyy kk:mm");

    ������� try{

    �������� CurDate =� df.parse(Curtime.substring(8,25));

    �������� // Creates a text file if no such file is there
    �������� // If file exists deletes all its data and then rewrites in it
    �������� raf = new RandomAccessFile("APR" + justNumbers(Curtime.substring(8,16),"-","") + ".txt","rw");
    �������� raf.setLength(0);
    �������� raf.seek(0);
    �������� raf.writeBytes(Curtime);

    ������� pf.setTimeZone(TimeZone.getTimeZone("GMT-14:00")); // new code

    �������� raf.writeBytes("Pacific Daylight Time = " + pf.format(CurDate) +"\r"); //new code

    One more try:
        public static void Phase3(String mstrODBC, String mstrTable)
            RandomAccessFile raf = null;
            java.util.Date CurDate = null;
            String Curtime = inetBank.getURL("http://128.138.140.44:13/");
            SimpleDateFormat df = new SimpleDateFormat("yy-MM-dd hh:mm:ss");
            String AvgApr = null;
            SimpleDateFormat pf = new SimpleDateFormat("MM/dd/yyyy kk:mm");
            try{
             CurDate =  df.parse(Curtime.substring(8,25));
             // Creates a text file if no such file is there
             // If file exists deletes all its data and then rewrites in it
             raf = new RandomAccessFile("APR" + justNumbers(Curtime.substring(8,16),"-","") + ".txt","rw");
             raf.setLength(0);
             raf.seek(0);
             raf.writeBytes(Curtime);
             //GMT-12:00 gives a time which is less than 12 hours of GMT time.
             // NIST time is 5 hours more than GMT. So, (5+7) total 12 subtracted to
             // get the desired time.
             pf.setTimeZone(TimeZone.getTimeZone("GMT-5:00"));
             raf.writeBytes("Pacific Daylight Time = " + pf.format(CurDate) +"\r");

  • How can we get current time date with resultset?

    Dear All,
    I have to insert current time date in the table.So,i need to get the current time and date with result set.So,I will first get the time date and then insert it into the table.
    I know how can we get current time and date without resultset.i have created this function its working.But now i want to use this.mean using resultset i want to put in the table.
    How can i do this?
    public static String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
    public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
    }

    yuck. Why not simply set a "new java.sql.Date()" to the SQL parameter in question?

  • Inserting Current Date with time stamp in oracle database

    Hi Experts,
                     I want to insert the current Date and time stamp in a field in the Oracle Database Table.
    I am able to insert date but i am not able to insert the date with time stamp. Any Suggestions??
    Thanks
    Naveen

    Naveen,
    Do you want to get current date (from sysdate) with a specific format or transform a value containing a date/time value to insert it in ORACLE ?
    Usually, you insert current datetimestamp in a date field using this :
    TO_DATE(sysdate,'dd/mm/yyyy hh:mi:ss')
    you may have to tweak the format pattern ('dd/mm....') according to your needs
    if you want to transform a date, use something like this:
    TO_DATE(your_date,your_format)
    but make sure your format is compliant with your date, ie
    TO_DATE('31/12/2008','MM/DD/YYYY') could raise error (litteral does not match) cuz ORACLE can't recognize 31 as a month pattern
    Chris

  • Insert current date/time problem in ViewObject

    Hi!
    I'm trying to setAttribute to a Date type field.
    I have a method:
    public String getCurrDateString() throws ParseException, java.sql.SQLException {
    SimpleDateFormat formatter = new SimpleDateFormat ("dd-MMM-yyyy hh:mm:ss aa");
    Date currentTime_1 = new Date();
    return formatter.format(currentTime_1);
    All the time i call this method such as:
    HistoryViewImpl histVO=getHistoryView();
    Row r=histVO.createRow();
    r.setAttribute("Entrydatetime",cp.getCurrDateString());
    I get oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:19-Jun-2002 10:14:33 AM
    the strange thing is, that Oracle recognizes this kind of format, because if I use different pattern such as "yyyy-MM-dd", which returns string "2002-06-19", r.setAttribute("Entrydatetime",cp.getCurrDateString()) method works fine and in Oracle table field we have inserted value 19-Jun-2002 12:00:00 PM. The problem is, that i don't need 12:00:00 PM as a time, i need current time.
    What am i doing wrong? Or does it mean that oracle.jbo.domain.Date doesn't know format "dd-MMM-yyyy hh:mm:ss aa"?

    Hi!
    I'm trying to setAttribute to a Date type field.
    I have a method:
    public String getCurrDateString() throws ParseException, java.sql.SQLException {
    SimpleDateFormat formatter = new SimpleDateFormat ("dd-MMM-yyyy hh:mm:ss aa");
    Date currentTime_1 = new Date();
    return formatter.format(currentTime_1);
    All the time i call this method such as:
    HistoryViewImpl histVO=getHistoryView();
    Row r=histVO.createRow();
    r.setAttribute("Entrydatetime",cp.getCurrDateString());Instead of passing in the "String" pass the date object as is. oracle.jbo.domain.Date should be able to convert java.sql.Date/Time/Timestamp and store the time bits as set.
    If you have to pass in string, then establish a Formatter on the attribute with appropriate date format and then use the AttributeHints interface from the relevant AttributeDef object on the row to parse the input String into a valid parsed object that you can set into the row.
    (See oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow() method for a complete usage - source in bc4j\src\bc4juisrc.zip)
    I get oracle.jbo.domain.DataCreationException: JBO-25009: Cannot create an object of type:oracle.jbo.domain.Date with value:19-Jun-2002 10:14:33 AM
    the strange thing is, that Oracle recognizes this kind of format, because if I use different pattern such as "yyyy-MM-dd", which returns string "2002-06-19", r.setAttribute("Entrydatetime",cp.getCurrDateString()) method works fine and in Oracle table field we have inserted value 19-Jun-2002 12:00:00 PM. The problem is, that i don't need 12:00:00 PM as a time, i need current time.
    What am i doing wrong? Or does it mean that oracle.jbo.domain.Date doesn't know format "dd-MMM-yyyy hh:mm:ss aa"?

Maybe you are looking for

  • Import

    Hi all, i was wondering is the flash import statement the same as a java import statement? in other words is it true that if i want to create a transition simply new fl.transitions.Tween(home_mc, "x",fl.transitions.easing.Elastic.easeOut,1000,0,30,tr

  • Itunes 7.1 install

    Please help!!! i have for the fourth time tried in vain to install itunes 7.1 i get error message saying service ipod could not be installed verify you have sufficient privileges to install system services....??? got my ipdnano all crarged up and not

  • Editing a form created with trial version of XI

    I have some forms that I have created with the trial version of Adobe XI and now I need to edit them. I keep getting an error that says the file is restricted and asks me to save a copy that is not restricted. When I save the copy, it won't let me ed

  • How to set userlevel permission for GFS and NFS

    hi how to set userlevel permission for GFS and NFS? regards

  • How do I edit my signature once its created?

    I have a typo in my signature and cant fgure out how to edit the actual signature or delete it and re-create one.