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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:40:45+00:00 2026-05-31T19:40:45+00:00

For eg, I have this code for my PHP calendar events application. /**MySQL code

  • 0

For eg, I have this code for my PHP calendar events application.

/**MySQL code to get the date*/
$get_Eventbyid_sql = "select event_title, event_shortdesc, event_start as fmt_date from
calendar_events where id=".$_GET['id'].";";

where event_start is my date/time fields.

So now I want to display its hour and minute components on the form.

for eg if event_start was 2012-03-25 02:30:00

Then I oughta get 02 and 30 by using the following code below.

echo "<input type=text name=event_time_hh value='".date("h",$fmt_date)."'>";
echo "<input type=text name=event_time_mm value='".date("i",$fmt_date)."'>";

But the results were different.

date(“h”, $fmt_date) returns 12:
date(“i”, $fmt_date) returns 33;

Where do these numbers come from? Where did I go so wrong?

  • 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-31T19:40:46+00:00Added an answer on May 31, 2026 at 7:40 pm

    The second argument to date needs to be a numeric timestamp, not a date string. Use:

    date('h', strtotime($fmt_date))
    

    Also, take care of that SQL INJECTION!

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

Sidebar

Related Questions

I have this php code $jsonArray = array(); $sql = SELECT ID,CLIENT FROM PLD_SERVERS;
I have this code (an example that PHP generates for me)... <select id=outsideBlue3> <option
I have this code in PHP $max=SELECT MAX(num) FROM info; $maxquery= mysql_query($max) or die
I have this code in PHP. It connects to the DB fine, but pops
I have this PHP code in a loop for every post on the admin
i have this php code and keep on getting errors upon fixing each error.
I have this php code $filename = verbs.php; // http://alylores.x10.mx/vega/verbs2.php $handle = fopen($filename, r);
i have this PHP code, and a DataBase with Question, answer1, answer2, Question_id well,
I have this code in userpage.php: <script langauge=JavaScript><!-- function newWindow(fileName,windowName) { msgWindow=window.open(fileName,windowName); } //--></script>
I have this code in my index.php. In Mozilla its ok. But in Ie

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.