Parameter format:date:2016-03-02Days:-3 (2) When a negative number is pushed forward with a positive number, the date is pushed backwardsfunction adddate (date, days) {var d = new Date (date);D.setdate (d.getdate () + days);var m = d.getmonth () + 1;var da = d.getdate ();if (mm = ' 0 ' + m;}if (dada = ' 0 ' + da;}return d.getfullyear () + '-' + M + '-' +da;}Method invocation$ (function MyFunction () {var td = "2016-03-02"var HG = Adddate (TD,-3);var now = new Date ();var nowstr = Now.format ("Yy
$week _arr;
}
Demo_ Call
/*
$year = ' 2013 ';
if (Get_all_weeks ($year)) {
Var_dump (Get_all_weeks ($year));
}else{
Echo ' date format error ';
}
*/
/**
* Gets the start date of the week in which the day is located
* Dependent function Get_all_weeks
* @param $day format: ' Yyyy-mm-dd '
* Return False Date format error
* Correct, return JSON "{" Begin_day ":" Yyyy-mm-
1. Date Format Method for binding:
2. How to format data items such as DataGrid and datalist:
E. Item. Cell [0]. Text = convert. todatetime (E. Item. Cell [0]. Text). to1_datestring ();
3. Convert the date display format with the string type:
String. Format ("yyyy-mm-dd", yourdatetime );
4. Convert the date display format using the convert method:
Convert. todatetime ("2005-8-23"). tostring
("Yymmdd", system. Globalization. datetimeformatinfo. inv
Linux uses the dd command to quickly generate large files, and the linuxdd command to generate
The dd command can easily create a specified size file, as shown in figure
Dd if =/dev/zero of = test bs = 1 M count = 1000
A m test file is generated. The file content is 0 (because it is read from/dev/zero,/dev/zero is 0)
However, the speed of writing files to the
To write time in standard format to log files. To convert time (now () to character format "YYYY-MM-DD hh: mm: SS Zzz"
Write this function, Delphi system itself also with the Conversion Function formatdatetime ('yyyy-MM-DD hh: mm: SS zzz', now ())
You can also implement this function. Considering that this is a fixed-format conversion function for further optimization.
// Actual test results
Run 1,000,000 f
First, you must understand two special devices:
/Dev/null: Recycle Bin, bottomless pit
/Dev/Zero: generate characters
Test the disk write capability
TIME dd If =/dev/Zero of =/test. dbf bs = 8 k count = 300000
Because/dev // zero is a pseudo device, it only produces a null compaction stream and does not generate Io for it. Therefore, Io is concentrated in the of file, and the of file is only used for writing, therefore, this command is equivale
CopyCode The Code is as follows: function checkinputdate (OBJ ){
VaR strdate = obj. value;
VaR Re =/^ (\ D {4})-(\ D {2})-(\ D {2}) $ /;
If (Re. Test (strdate) // determines that the date format complies with the YYYY-MM-DD Standard
{
VaR dateelement = new date (Regexp. $1, parseint (Regexp. $2, 10)-1, Regexp. $3 );
If (! (Dateelement. getfullyear () = parseint (Regexp. $1) (dateelement. getmonth () + 1) = parseint (Regexp. $2, 10) (dateelement. get
Write speed:TIME dd If =/dev/Zero of = test. dbf bs = 8 k count = 300000Among them,/dev/zero is a pseudo device, which only generates a null compaction stream and does not generate Io for it. Therefore, Io will be concentrated in the of file, and the of file is only used for writing, therefore, this command is equivalent to testing the disk write capability.The output result is similar (because the test time is generally longer and more accurate, you
Linux file system swap swap partition and DD command details (3)1. Create swap partition: Partition type 82 is equivalent to virtual memory in WindowsMkswap/dev/sda5 creating a Swap partition file system region-L label create label for swap partitionSWAPON/DEV/SDA5 enable the specified swap partition-A: Enable all swap partitions defined in the/etc/fstab file-S: View swap partitionsSWAPOFF/DEV/SDA5 closing the specified swap partition2.free-m viewing
Copy Code code as follows:
function Checkinputdate (obj) {
var Strdate=obj.value;
var re =/^ (\d{4})-(\d{2})-(\d{2}) $/;
if (Re.test (strdate))//Judgment date format conforms to YYYY-MM-DD standard
{
var dateelement=new Date (Regexp.$1,parseint (regexp.$2,10) -1,regexp.$3);
if (!) ( (Dateelement.getfullyear () ==parseint (regexp.$1)) ((Dateelement.getmonth () +1) ==parseint (regexp.$2,10)) (Dateelement.getdate () ==parseint (regexp.$3)))/
1. Bind timed Format Date method:2. Data controls such as Datagrid/datalist format Date method:E.item.cell[0]. Text = Convert.todatetime (e.item.cell[0]. Text). ToShortDateString ();3. Use the string class to convert the date display format:String.Format ("Yyyy-mm-dd", yourdatetime);4. Convert date display format with convert method:Convert.todatetime ("2005-8-23"). Tostring("YyMMdd", System.Globalization.DateTimeFormatInfo.InvariantInfo); Support for
1 The basic format of the DD commandDD if=xxx of=xxx bs=xxx count=xxx2 about BSBS reads and writes data in blocks, and every time a piece of data is read and written, BS is the size of the specified block. The size of this block can be arbitrary. This arbitrariness allows DD to do a lot of things, just to set the size of BS as needed.2.1 Getting the entire MBRDD IF=/DEV/SDA of=mbr.img bs=512 count=12.2 Get
Dd and cpio commands are used to back up the linux system-general Linux technology-Linux technology and application information. The following is a detailed description. Dd command
[Root @ linux ~] # Dd if = "input_file" of = "output_file" bs = "block_size" count = "number"
If: input file ??? Department tip Yun, parent dad, Mian FU
Of: output file ~ It can also b
Copy the CPP file from windows to Linux, or from Linux to another Linux. CPP ,. H files often fail to be compiled. It is revealed that three more "things" are added at the beginning, such as tray357. We can't see VI, because it's not a character, and we don't know what the situation is. We inserted three bits of data. At this time, we can only copy the file again, through the graphic interface, or command DD.
Explanation of dd commands in CentOS
Dd: The biggest feature is backup.
[Root @ linux ~] # Dd if = "input_file" of = "outptu_file" bs = "block_size "\Count = "number"Parameters:If: input file ~ It can also be a device!Of: output file ~ It can also be a device;
Bs: the size of a planned block. If no value is set, the default value is 512 bytes.Count: the number of
1. ddif/dev/zerooftestbs64kcount16k is not accurate because the data is not actually written to the disk at the end of the command. ddif/dev/zerooftestbs64kcount16kconvfsync is accurate, and data has been written to disk 3.dd
1. dd if =/dev/zero of = test bs = 64 k count = 16 k
This is not accurate because the data is not actually written to the disk at the end of the command.
2.
Linux demo dd test IO
Dd is often used to test the read/write performance of a directory.
Test environment: Ubuntu system on your computer ~ Other Unix/Linux systems can also use dd.
Tips: dd operations need to be thought twice. confirm that there is no problem before proceeding! Once the direction is reversed, no d
Format the USB flash disk first: Use fdisk-L to view the USB flash disk to the mount point, for example,/dev/sdb1. Unmount the USB flash disk and run the format command mkfs. vfat/dev/sdb1.
Then re-mount the USB flash drive to create the boot disk:
# dd if=/ntfs/linux_all/sys/CentOS-7.0-1406-x86_64-DVD.iso of=/dev/sdb
Note that/dev/SDB is not/dev/sdb1 and an error is returned.In this case, you can re-open a terminal and run the
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.