1. Price display problems such as price display (¥358,179,682) are often encountered in application development.
Private string getstring (string Str)
{
If (Str. Equals ("") | STR = "")
{
Return "";
}
Else
{
Locale. setdefault (locale. China); // in Chinese Language
Numberformat currencyformat = numberformat. getcurrencyinstance ();
String [] arr = currencyformat. Format (long. parselong (STR ))
. Replace (".", ""). Split ("");
Return arr [0];
}
}
2. Get the current date and time three months ago (note that other methods may encounter errors of 4.31 or 2.29)
/**
* @ Description get the current date and time three months ago
*/
Public void getdate ()
{
Simpledateformat SDF = new simpledateformat ("yyyy-mm-dd ");
Calendar Cal = calendar. getinstance ();
Date = Cal. gettime ();
Mdate = SDF. Format (date );
Cal. Add (calendar. Month,-3 );
Date fdate = Cal. gettime ();
Mfdate = SDF. Format (fdate );
}