1. Get System Current Date
1. var variable name: Date=new Date ();
2. Var today:date=new Date ();
3. Trace (today);
Because Flex is a client program, the time to get is also the client
Recently due to the need to work with PHP get the current week and last week's start date and end date. Online to find the next, no suitable, so I did a summary. The specific content and code are as follows.
' Echo ' This week's End date: ', $now _end, '' Echo ' last week start
Js date range initialization method to get the date of the previous month, js Initialization
This example describes how to initialize the js date range to get the date of the previous month. Share it with you for your reference. T
This article describes how to initialize the js Date range to get the date of the previous month. it involves related techniques related to the date of javascript operations and is very useful, for more information about how to initialize the js date range, see the following
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))
days_before= ' date-d @
This article describes how to initialize the js date range to get the date of the previous month. It involves related techniques related to the date of javascript operations and is very useful, for more information about how to initialize the js date range, see the following
Js date range initialization method to get the date of the previous month
The initialization of the time range is set today. The start time is the previous month of the current time, and the perfect solution is finally found.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Should be interactive, choose JS to achieve, is also a pair of programming for the preliminary. I'll have the display part written in HTML, click on the button to trigger the event function is check ();
Copy Code code as follows:
function Oncheck () {
var year = document.getElementById ("year"). Value; Gets the text box "year" var theyear =year * 1; Convert to Number type//alert (theyear); Get month value
var month = document.getE
;} Get the number of days that the current date differs from this Sunday privateintgetmondayplus () {Calendarcd= Calendar.getinstance ();// get today is day of the week, Sunday is the first day, Tuesday is the second day ... intdayofweek=cd.get ( Calendar.day_of_week) -1;//because of the first day of worship in China,
PHP uses Strtotime to get last month, next month, month's date, Strtotime last month
Write the program today, suddenly found a long time to write a long time to get the number of days of the function, the classic switch version, but to get the number of days last month, I j
.1LocalDatenow=LocalDate.now();2LocalDateplusDate=now.plus(1,ChronoUnit.WEEKS);3System.out.println(now);4System.out.println(plusDate);Results:12018-06-2022018-06-27You can see that the new date is 7 days from today, that is, a week. You can add 1 months, 1 years, 1 hours, 1 minutes, or even a century in the same way, more options to view the Chronounit class in the Java 8 API.Example 9, calculating a
var mydate = new Date ();Mydate.getyear (); Get Current year (2-bit)Mydate.getfullyear (); Get full year (4-bit, 1970-????)Mydate.getmonth (); Get Current month (0-11, 0 for January)//So get current month is mydate.getmonth () +1;Mydate.getdate ();
var mydate = new Date ();Mydate.getyear (); Get Current year (2-bit)Mydate.getfullyear (); Get full year (4-bit, 1970-????)Mydate.getmonth (); Get Current month (0-11, 0 for January)//So get current month is mydate.getmonth () +1;Mydate.getdate ();
= Saturday)MySQL Yearweek () function, returns the year (+) + Week position (31).5. MySQL returns the week and month name functions: Dayname (), MonthName ()Set @dt = ' 2008-08-08 ';Select Dayname (@dt); --FridaySelect MonthName (@dt); --AugustThink, how to return the name of Chinese?6. MySQL Last_day () function: Returns the last day of the month.Select Last_day (' 2008-02-01 '); -2008-02-29Select Last_day (' 2008-08-08 '); -2008-08-31The MySQL Last_day () function is useful, for example, I wa
() function, returns the year (+) + Week position (31).5. MySQL returns the week and month name functions: Dayname (), MonthName ()Set @dt = ' 2008-08-08 ';Select Dayname (@dt); --FridaySelect MonthName (@dt); --AugustThink, how to return the name of Chinese?6. MySQL Last_day () function: Returns the last day of the month.Select Last_day (' 2008-02-01 '); -2008-02-29Select Last_day (' 2008-08-08 '); -2008-08-31The MySQL Last_day () function is useful, for example, I want to
Shell script to get the formatting Date and Time Summary
The Shell script obtains the formatting Date and Time summary. The Linux bash script's support for time formats exceeds my expectation and supports changes and outputs in multiple formats. It is even more convenient than java APIs. It is summarized as follows:
#! /Bin/sh # upload logs to hdfssource/etc/prof
Today, when I write the program, suddenly found a long time ago to get the number of days of the function, the classic switch version, but to get the number of days last month, I just put the month-1, I guess it was too sleepy, and then see a kind of creepy feeling, would like to deal with, But I think there are some super convenient way, so I found the following
Because the job needs to get last month, next month, this month's date, special from the website found the implementation code, special sharing, easy to use friends
Write the program today, suddenly found a long time to write a long time to get the number of days of the function, the classic switch version, but to
the date class is relatively simple * * @author nbsp Singlex */ importjava.util.*; publicclasstestdate2{ publicstaticvoid main (String[]args) { calendar ca=calendar.getinstance (); intyear=ca.get (Calendar.YEAR);// Get year intmonth=ca.get (Calendar.MONTH);// Get month intday=ca.get (Calendar.DATE) ;// Get
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.