Home Backend Development PHP Tutorial 一个关于时间有关问题

一个关于时间有关问题

Jun 13, 2016 am 10:09 AM
calendar get quot strtotime

一个关于时间问题
当前的日期通过控件获得:

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$thisday = $_GET['calendar'];
Copy after login

现在我想求这个日期的前一天(查询日历日期的前一天),怎么求?

注:日历的字符串形式 Y-m-d

------解决方案--------------------
-1day
------解决方案--------------------
echo date('Y-m-d', strtotime("-1 day $thisday"));
------解决方案--------------------
如果$_GET['calendar']的时间格式类似“2012-02-14 11:56:30”,则先转换为time格式:strtotime($_GET['calendar'])
然后减去一天的秒数就可以啦:strtotime($_GET['calendar'])-60*60*24

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to automate tasks using PowerShell How to automate tasks using PowerShell Feb 20, 2024 pm 01:51 PM

If you are an IT administrator or technology expert, you must be aware of the importance of automation. Especially for Windows users, Microsoft PowerShell is one of the best automation tools. Microsoft offers a variety of tools for your automation needs, without the need to install third-party applications. This guide will detail how to leverage PowerShell to automate tasks. What is a PowerShell script? If you have experience using PowerShell, you may have used commands to configure your operating system. A script is a collection of these commands in a .ps1 file. .ps1 files contain scripts executed by PowerShell, such as basic Get-Help

How does java initiate an http request and call the post and get interfaces? How does java initiate an http request and call the post and get interfaces? May 16, 2023 pm 07:53 PM

1. Java calls post interface 1. Use URLConnection or HttpURLConnection that comes with java. There is no need to download other jar packages. Call URLConnection. If the interface response code is modified by the server, the return message cannot be received. It can only be received when the response code is correct. to return publicstaticStringsendPost(Stringurl,Stringparam){OutputStreamWriterout=null;BufferedReaderin=null;StringBuilderresult=newSt

Example of Curl Get command Example of Curl Get command Mar 20, 2024 pm 06:56 PM

In Linux, URL or Curl client is a popular command line utility that allows you to transfer data over the network using various protocols such as HTTPS, HTTP, FTP, etc. It allows you to send and receive data using its get, post and request methods. Among them, you need to use the &quot;get&quot; method frequently. Therefore, it becomes crucial to learn various methods and various options that you can use to increase your productivity. &quot;Performing a curl operation is as simple as entering a few simple commands. Although it seems simple, many users do not fully realize its potential. Therefore, this short guide provides some information on how to perform curl operations on Linux systems. Example using the &quot;curlget&quot; command.&quot; Curl

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决 Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code

How to change Ubuntu's apt-get update source? How to change Ubuntu's apt-get update source? Jan 05, 2024 pm 03:40 PM

Manually modify Ubuntu's apt-get source 1. Use the ssh tool to connect to Ubuntu (I use xshell) 2. Type cd/etc/apt/3 on the command line and back up the source.list file in this directory (you must have sudo permissions) ), then there is a source.list.bak file. 4. Clear the source.list file content (note: it cannot be restored after clearing, so you need to perform the previous step to back up the file in advance). At this time, use sudo to prompt that the permissions are insufficient. Switch directly to the root user and execute this command. 5. Use vim to open source.list, press the i key to enter the editing mode, paste the source address to be modified, and then press

In-depth analysis of the similarities and differences between the get method and post method in jQuery In-depth analysis of the similarities and differences between the get method and post method in jQuery Feb 24, 2024 pm 12:15 PM

Get and post are two commonly used ajax request methods in jQuery, which are used to send requests to the server and obtain data. They have some differences in usage and some features. Next we will explain their similarities and differences in detail, and attach specific code examples. The similarities between get and post: they are both methods for sending ajax requests. You can obtain data from the server by specifying the URL and data parameters. Both can accept callback functions as parameters, which are used to process data returned by the server or handle failed requests.

Java uses the get() function of the Calendar class to obtain date and time information Java uses the get() function of the Calendar class to obtain date and time information Jul 24, 2023 am 09:40 AM

Java uses the get() function of the Calendar class to obtain date and time information. In Java programming, we often need to obtain the current date and time information. Java provides many classes and methods to handle dates and times, among which the Calendar class is one of the commonly used ones. The Calendar class provides many methods to handle date and time operations, including obtaining various parts of date and time information. In the Calendar class, we can use the get() method to get the date and time

How does SpringBoot use entities to receive multiple parameters passed by the Get request? How does SpringBoot use entities to receive multiple parameters passed by the Get request? May 19, 2023 pm 06:01 PM

1. The first method of the Controller layer receiving parameters without any annotations is the simplest. I seriously doubt why it was not used before. Who knows. . But this time it really worked. The simplest way is to add the Controller interface without adding any annotations! ! ! SpringBoot handles this automatically. The code is as follows: /***@authorzhangzhixiang*@sincev1.0.0*/@RestController@RequestMapping(path="/ui/institution")publicclassInstitutionManagemen

See all articles