How to solve the hourly computation in a simple calendar program

Source: Internet
Author: User
In a simple calendar program, hourly computation is used to solve a simple personal calendar program. one function is to enter the calendar or notebook. when writing data tables, the hourly computation code is as follows, what does the red part mean? $ Evt_pm (isset ($ _ POST [evt_pm]) & amp; $ _ POST [evt_pm] yes ); $ evt_hour (isset ($ _ POST [evt an hourly computation solution in a simple calendar program
In a simple personal calendar program, one function is to enter a calendar or notebook. when writing data tables, the hourly calculation code is as follows. what does the red code mean?

$ Evt_pm = (isset ($ _ POST ['evt _ pm ']) & $ _ POST ['evt _ pm'] = 'yes ');
$ Evt_hour = (isset ($ _ POST ['evt _ hour '])? (Int) $ _ POST ['evt _ hour']: 0;

If ($ evt_pm)
{
$ Evt_hour + = 12;
}
If ($ evt_hour = 24)
{
$ Evt_hour = 12;
}
Else if ($ evt_hour = 12)
{
$ Evt_hour = 0;
}

// Write data to the database
$ Query = sprintf ('Insert INTO % sCALENDAR (EVENT_NAME, EVENT_TSTAMP ,'.
'Your Y) VALUES ("% s", "% 04d-% 02d-% 02d % 02d: % 02d: 00", % d )',
DB_TBL_PREFIX,
Mysql_real_escape_string ($ evt_name, $ GLOBALS ['DB']),
$ Year, $ month, $ day,
$ Evt_hour, $ evt_min,
$ Evt_policy );


The form for submitting a calendar is as follows:
// Hour selection
12 For ($ I = 1; $ I <12; $ I ++){Printf ('% 02d', $ I, $ I );}?>

// Select in minutes
For ($ I = 0; $ I <59; $ I + = 15){Printf ('% 02d', $ I, $ I );}?>

// Select the last afternoon
AM PM


------ Solution --------------------
I only read the red part. I guess it should be 24 hours to 12: 12 hours to 0, that is, 24 hours to 12 hours? Haha
------ Solution --------------------
Storage time format.
------ Solution --------------------
Understand the time format.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.