function DateAdd (interval,number,date) {/* * Feature: Enables VBScript DATEADD functionality.
* Parameter: interval, a string expression representing the time interval to add.
* Parameter: number, numeric expression, representing the amount of
Original source http://hi.baidu.com/tonlywang/item/685fba8933a2a756e73d1950One, date minus days equals second date function cc (DD,DADD) ... {//Can be added with error handling var a = new Date (dd) a = a.valueof () A = A-dadd * $ * 1000a = new
The following code is some of the most commonly used date processing functions, can be two times the date plus and minus, the difference between the two dates, date conversion time cut.
echo Date (' y-m-d ', Strtotime (' +1 d ', strtotime (' 2009-07
--StartWe all know that numbers can be added, minus, multiply, divide, and so on. So, could the date be? The answer is that the date can only be added, minus operations.Before starting the operation date, let's look at what date data types are
Problem description:
In oracle 10 Gb, the user table has a date type field in the format of yyyy-MM-dd HH: mm: ss. When the front-end is displayed, it can only be displayed as hh after yyyy-MM-dd: mm: ss is not displayed.
After some painful analysis,
in PHP by adding or subtracting a day from a date, we get another date, and we'll use two examples to show that one is Strtotime and mktime the time to the time stamp to be processed again, the classmate who needs to see.
The following example: Date
For daily Statistics, our date ("Ymd") is converted to integer as the primary key of the database, so it is necessary to use time to add and subtract when searching for a period of time statistic data;
For example, data within 30 days
function
In python, the date and time function does not seem to add a date (time) variable to the function for a few months. It is written in the same way as in Delphi.CodeAs follows:
Import calendar
Yearmonth = (, 31, 31 ),(, 31, 31 ))
def addmonths
One, date minus days equals second date
function cc (DD,DADD) {
//can be added error handling
var a = new Date (dd)
a = a.valueof ()
a = a-dadd * * * * * 1000
a = new Date (a)
alert (a.getfullyear () + "year" + (A.getmonth () + 1) +
The most recent item in the train ticket, because the maximum range of train voting dates is 20 days, which is to control a date within 20 days of the current timebegan to look for a direct modification of the Web date prototype later the leader
1, first through the strtotime () to obtain the date of the time stamp
2, get the time of N days before the timestamp, through the "current timestamp-n days of seconds = n days before time stamp"
3, for n days before the time stamp with the date
Import Java.util.Date;Import Java.text.SimpleDateFormat;Import Java.util.Calendar;public class TestDate {public static void Main (string[] args) throws Exception {Creates an object of a date format class that can format strings according to the
Example:
What was the date 50 days ago?
Computation (@{sys:date}= today,-50 minus 50,unit=day unit for day)
Output calculation results
results: 50 days ago is @{test:date} complete output result
full output
keyvalue
If you want to take the exam, write it. If you have the same requirements, take it away.
# Include
Void main () // defines some date functions
{
Char tmps;
Do
{
Printf ("enter a date (year month day )");
Int year, month, day, tmp;
Requirement: The following serial number must be generated. The first half is a year, month, and day number in yyyymmdd format. The second half is a number that increases sequentially from 1 day, And the digits must be fixed, fill in 0 for the
Date_begin.ToString ()! = "0" | date_20.t.tostring ()! = "0" indicates the start date and end date of the database query.
// For string type, the default value is 0.
If (date_begin.ToString ()! = "0" | date_20.t.tostring ()! = "0 "){If (date_begin.
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.