#-*-coding:utf-8-*-" "Gets the date of n days or n months before and after the current date" " fromTimeImportstrftime, LocalTime fromDatetimeImportTimedelta, DateImportCalendarYear= Strftime ("%Y", LocalTime ()) Mon= Strftime ("%m", LocalTime ())
DateFormat1. DateFormat IntroductionThe role of DateFormat is to format and parse the date/time. In fact, it is the date formatting tool that helps us format date and then converts date into the string string we want to useHowever, the DateFormat
// Function Name: trim// Function Description: removes spaces at the beginning and end of a string.// Creation Date:// Last Modify By: N/// Last Modify Date: N/String. prototype. trim = function (){Return this. replace (/(^ \ s *) | (\ s * $)/g ,"");
@ Echo offRem calculates the date before the specified number of daysSet daysago = 10Rem assumes that the system date format is yyyy-mm-dd.Call: datetodays % Date :~ 0, 4% % Date :~ 5, 2% % Date :~ 8, 2% passdaysSet/A passdays-= % daysago %Call:
First, create test files test.sh
#!/bin/sh
./etc/profile
# Parameters:
# Args[0], data date, date format Yyyy-mm-dd
# Take 30 days before the date
function Get_date_ 30daysbefore ()
{
sec= ' date-d $ +%s '
sec_30daysbefore=$ ((sec-86400*30))
Ruby treats files and I/O operations as Object oriented.
Ruby's I/O system
The IO class handles all input and output streams.
IO class
An IO object represents a readable writable connection to a disk file, keyboard, screen, or device.
These
This article to introduce you to the use of PHP with Strtotime or mktime specified date data (this week, last week, this month, last month, this quarter) instance, I hope that the students will help you.Strtotime Definition and usageThe strtotime ()
Strtotime Definitions and usage
The strtotime () function resolves the date-time description of any English text to a Unix timestamp.
Grammar
Strtotime (time,now) parameter descriptionTime to specify the string to parse.Now is the time stamp used
Use php to get the code for the date of this week, last week, this month, last month, and this quarter.
The code is as follows:
Echo date ("Ymd", strtotime ("now"), "\ n ";
Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";
Echo date ("Ymd",
Copy codeThe Code is as follows:Echo date ("Ymd", strtotime ("now"), "\ n ";Echo date ("Ymd", strtotime ("-1 week Monday"), "\ n ";Echo date ("Ymd", strtotime ("-1 week Sunday"), "\ n ";Echo date ("Ymd", strtotime ("+ 0 week Monday"), "\ n ";Echo
Use php to obtain the echodate (Ymd, strtotime (now), n ;?? Echodate (Ymd, strtotime (-1 weekMonday), n ;?? Echodate (Ymd, strtotime (-1 weekSunday), obtained this week, last week, this month, last month, and this quarter date using php (abstract)
How do I get the timestamp of this week, last week, this month, the beginning and the end of the month
Reply to discussion (solution)
echo Date ("Ymd", Strtotime ("Now"), "\ n";echo Date ("Ymd", Strtotime ("1 week Monday")), "\ n";echo Date ("
How can I get the timestamp of this week, last week, this month, last month, and end? how can I get the timestamp of this week, last week, this month, last month, start and end?
Reply to discussion (solution)
Echo date ("Ymd", strtotime ("now"),
PHP implementation of DateDiff and DateAdd time function code sharing, Datediffdateadd
Extended time functions in PHP DateDiff and DateAdd
function DateDiff ($part, $begin, $end) {$diff = Strtotime ($end)-Strtotime ($begin), switch ($part) {case "Y"
This article mainly introduces the code sharing of the DateDiff and DateAdd time functions implemented by php. DateDiff is used to calculate the two time intervals, and DateAdd is used to add the two time periods, for more information about how to
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.