);//CompressionUIImage *image = [UIImage imagenamed:@" Avatar 1" ];NSData *data =uiimagepngrepresentation (image); //in the network development, when uploading a file, the file is not allowed to be overwritten, the file name is duplicate //To resolve this issue, //You can use the current system event as the file name at upload timeNSDateFormatter *formatter =[[NSDateFormatter alloc] init]; //set the time formatFormatter.dateformat =@"
. Its value is displayed as a number.The format of the TIMESTAMP value display size is as follows::
+ --------------- + -------------- + | Column type | display format | TIMESTAMP (14) | YYYYMMDDHHMMSS | TIMESTAMP (12) | YYMMDDHHMMSS | TIMESTAMP (10) | YYMMDDHHMM | TIMESTAMP (8) | YYYYMMDD | TIMESTAMP (6) | YYMMDD | TIMESTAMP (4) | YYMM | TIMESTAMP (2) | YY | + ------------- + ---------------- +
The "complete" TIMESTAMP format is 14 bits, but the TIME
members
4. Date and Time Data
Type
Storage space
Description
Maximum length
Date
3 bytes
YYYY-MM-DD format Representation
1000-01-01 ~ 9999-12-31
TIME
3 bytes
Hh: mm: ss format indicates the time value
-838: 59: 59 ~ 838: 59: 59
DATETIME
8 bytes
YYYY-MM-DD hh: mm: ss format
TIMESTAMP
4 bytes
The format of YYYYMMDDhhmmss indi
Mysql time conversion statement mysql> select UNIX_TIMESTAMP ();-> 882226357 mysql> select UNIX_TIMESTAMP ('2017-10-04 22:23:00 ');-> 1997 when UNIX_TIMESTAMP is used for a TIMESTAMP column, the function will directly accept the value without the implicit "string-to-unix-timestamp" transformation. FROM_UNIXTIME (unix_timestamp) www.2cto.com returns the value represented by the unix_timestamp parameter in 'yyyy-MM-DD HH: MM: ss' or YYYYMMDDHHMMSS forma
Select a file from one directory, copy to another directory1 stringSourcephotopath = This. Getuserselectedphoto ();2 if(Sourcephotopath = =NULL)3 {4 return;5 }6 stringsourceFileName =System.IO.Path.GetFileName (sourcephotopath);7 //Save the picture to a folder8 stringUserName = This. Loginusername;9 stringNewPath =@"Images";Ten if(!System.IO.Directory.Exists (NewPath)) One
. None );StreamReader sr = new StreamReader (fs, System. Text. Encoding. GetEncoding (936 ));String str = "";String s = Console. ReadLine ();While (str! = Null){Str = sr. ReadLine ();String [] xu = new String [2];Xu = str. Split (',');String ser = xu [0];String dse = xu [1];If (ser = s){Console. WriteLine (dse); break;}}Sr. Close ();
You can also import the database data to a txt file. The example is as follows:
Copy codeThe Code is as follows:// Txt file nameString fn = DateTime. now. toString
1, how to put a string such as "20110826134106" into any date-time format, the following list of two types:nsstring* string [email protected] "20110826134106";Nsdateformatter*inputformatter = [[[NSDateFormatter alloc] init]autorelease];[Inputformattersetlocale:[[[nslocale Alloc] Initwithlocaleidentifier: @ "en_US"]autorelease]];[inputformattersetdateformat:@ "Yyyymmddhhmmss"];Nsdate*inputdate = [Inputformatter datefromstring:string];NSLog (@ "date=%@"
. Public Httpresponsemessage Export () {//fetch data var lstres = Orderbll.export (); Populate Excel with data hssfworkbook workbook = new Hssfworkbook (); Createandfillsheet (workbook, Lstres); Save to service var fileName = "Excel" + DateTime.Now.ToString ("YYYYMMDDHHMMSS") + ". xls"; var strpath = Path.Combine (AppDomain.CurrentDomain.BaseDirectory, @ "data\" + fileName); using (FileStream
=NewFolderBrowserDialog (); varres =Folderpicker.showdialog (); //determine if the user has a folder selected if(res = = System.Windows.Forms.DialogResult.Cancel)return; //File Save path varFolderPath =Folderpicker.selectedpath; varFileName = DateTime.Now.ToString ("YYYYMMDDHHMMSS"); varFileuri = FolderPath +"\\"+ FileName +". PNG"; //The default DPI appears to be 96 under the Windows system, but the current native test considers the DPI settin
app. ConfigAnnotations:①, autoreload= "true" means that if the configuration file is modified without restarting the application, Nlog will automatically load the app;Internalloglevel= "Trace" internallogfile= "Logs/internallog.txt" This setting can write Nlog internal log messages to the InternalLog.txt file in the Logs folder in the application directory (this configuration is often used to debug nlog configuration is correct, after debugging, it is best to shut down to improve performance)②,
new content aboveTry{// Specify the HTML file to be generatedString fname = Server. mapPath (".. /.. /"+" NewsFiles/"+ DateTime. now. toString ("yyMMdd") + "/" + DateTime. now. toString ("yyyymmddhhmmss") + ". html ";// Replace the new content in the html Template FileFor (int I = 0; I {Strhtml. Replace ("$ htmlkey [" + I + "]", newContent [I]);}// Create a file information objectFileInfo finfo = new FileInfo (fname );// Create a file stream in the f
":Case "image/jpeg ":IsfileTypeImages = true;Break;}
Here, the file type is determined and the test result is verified. Therefore, it must be the correct file header. Another part of the code is to detect the file content. The author of this system is indeed very responsible.
2. The following is a function for generating file names.
Public string CreateFileName ()
{
String guid = Guid. NewGuid (). ToString (). ToLower (). Replace ("-","");
Return (DateTime. Now. ToString ("
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.