Establish a free accounting date for the report--1.1. Recognize several functions related to time _access

Source: Internet
Author: User
Tags time interval

1. Recognize several functions related to time 1.Cdate (date expression) converts a date expression to data of a date type. A date expression is any expression that can be interpreted as a date, contains a date literal, can be viewed as a string of dates, and a date returned from a function. For example: MyDate = CDate ("99-5-20"), such a date expression must be double quotes, otherwise the result is unpredictable. CDate determines the format of the date according to the locale on the system. If the format provided is an unrecognized date setting, the order of year, month, and day is not correctly judged. 2.Now () returns the date and time of the current computer system setting. 3.Year (date expression) returns an Integer that represents the year. For example: Year ("00-6-15") = 4.Month (date expression) returns an integer from 1 to 12, which represents the month of the day. For example: Month ("00-6-15") = 6 5.DateAdd (interval, number, date) returns a date, plus a period of time interval. You can use DATEADD to calculate a date that is 30 days away from today, or to calculate a time of 45 minutes from now. Dataadd function parameter parameter description interval string expression is the unit of time interval to add. Number numeric expression, is the amount of time interval to add. The value can be positive (get a future date), or it can be negative (get past date). Date-date expression, which is also preceded by a time interval. Interval parameter setting value description yyyy year Q season m month y a year day number D Day W weekly days WW Week h when N minutes s sec for example:
DATEADD ("D", 10, "2000-6-18") = 2000-06-28
DateAdd ("M",-1, "2000-6-18") = 2000-05-18

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.