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 7507323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:27:57+00:00 2026-05-29T22:27:57+00:00

I have a field called date_time in the database which is of type datetime

  • 0

I have a field called date_time in the database which is of type datetime.
I have a form which on submit needs to enter the current date and time in the date_time field.
How do I write my code so that the date_time field gets inserted with the current datetime.
The following is my code: (I know I can’t call NOW() like that, but I wanted to show what I want to achieve)

$qcData = Array(
    "date_time" => NOW(),
    "note" => $note                                         
);

$qcNotes = new App_Model_DbTable_QCNotes();
$qcNotes->insert($qcData);
  • 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-29T22:27:57+00:00Added an answer on May 29, 2026 at 10:27 pm

    here it is from the docs

    26.3.1. Current Date Without any arguments, constructing an instance returns an object in the default locale with the current, local date
    using PHP’s time() function to obtain the UNIX timestamp for the
    object. Make sure your PHP environment has the correct default
    timezone
    .

    Example 26.2. Creating the Current Date

    $date = new Zend_Date();
    
    // Output of the current timestamp Feb 13, 2012 10:28:59 PM 
    print $date;
    //implement toString() output 2012-02-13 22:30:25
    print $date->toString('YYYY-MM-dd HH:mm:ss');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge database (800MB) which consists of a field called 'Date Last
I have a field called dPostTime , which has the date and time stored
I have a class User with one field called birthDate which is a java.sql.Date
I have a custom field called HourField, which lets you enter 1:30 to represent
I have an sqlite database which currently holds an integer field called Year which
i have a date/time field called MyDate. Originally, its format is mm/dd/yyyy and there
I have a custom UserType which stores a date/time value in a TIMESTAMP field
I have a database field called abCode , that I want to map to
I have an ActiveRecord model with a field called name (in the database) and
Say I have a model object 'Person' defined, which has a field called 'Name'.

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.