本文整理汇总了Java中java.text.SimpleDateFormat.getDateTimeInstance方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleDateFormat.getDateTimeInstance方法的具体用法?Java SimpleDateFormat.getDateTimeInstance怎么用?Java SimpleDateFormat.getDateTimeInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.text.SimpleDateFormat
的用法示例。
在下文中一共展示了SimpleDateFormat.getDateTimeInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showStartBanner
import java.text.SimpleDateFormat; //导入方法依赖的package包/类
/**
* Show a message stating the JmxDumper has been started, with the current date and time.
*/
private static void showStartBanner(PrintWriter out)
{
DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
out.println(JmxDumpUtil.class.getSimpleName() + " started: " + df.format(new Date()));
out.println();
}
示例2: getExeArguments
import java.text.SimpleDateFormat; //导入方法依赖的package包/类
/**
* Returns arguments to pass to SVN executable including SVN
* command and it args.
*/
protected String getExeArguments() throws IOException, AgentFailureException {
final DateFormat format = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.SHORT, SimpleDateFormat.MEDIUM, agent.defaultLocale());
final String beginDateString = historyParams.getBeginDate() != null ? format.format(historyParams.getBeginDate()) : (String) null;
final String endDateString = historyParams.getEndDate() != null ? format.format(historyParams.getEndDate()) : (String) null;
final StringBuffer args = new StringBuffer(100);
args.append(" history");
appendCommand(args, "-excludeactions", "label,snapshot,branch");
appendCommandIfNotBlank(args, "-begindate", beginDateString == null ? (String) null : StringUtils.putIntoDoubleQuotes(beginDateString));
appendCommandIfNotBlank(args, "-rowlimit", historyParams.getRowLimit() == Integer.MAX_VALUE ? "" : Integer.toString(historyParams.getRowLimit()));
appendCommandIfNotBlank(args, "-enddate", endDateString);
args.append(' ').append(historyParams.getRepositoryPath());
return args.toString();
}
示例3: onCreate
import java.text.SimpleDateFormat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useImmersiveMode = true;
Mindustry.hasDiscord = isPackageInstalled("com.discord");
Mindustry.platforms = new PlatformFunction(){
DateFormat format = SimpleDateFormat.getDateTimeInstance();
@Override
public String format(Date date){
return format.format(date);
}
@Override
public String format(int number){
return NumberFormat.getIntegerInstance().format(number);
}
@Override
public void openLink(String link){
Uri marketUri = Uri.parse(link);
Intent intent = new Intent( Intent.ACTION_VIEW, marketUri );
startActivity(intent);
}
@Override
public void addDialog(TextField field, int length){
TextFieldDialogListener.add(field, 0, length);
}
@Override
public void openDonations() {
showDonations();
}
@Override
public void requestWritePerms() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if(checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED &&
checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE}, WRITE_REQUEST_CODE);
}else{
if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, WRITE_REQUEST_CODE);
}
if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, WRITE_REQUEST_CODE);
}
}
}
}
};
if(doubleScaleTablets && isTablet(this.getContext())){
Unit.dp.addition = 0.5f;
}
config.hideStatusBar = true;
Net.setClientProvider(new KryoClient());
Net.setServerProvider(new KryoServer());
initialize(new Mindustry(), config);
}
示例4: getTrafficLog
import java.text.SimpleDateFormat; //导入方法依赖的package包/类
private static StringBuilder getTrafficLog(Context context) {
StringBuilder sb = new StringBuilder();
Cursor cursor = DatabaseHelper.getInstance(context).getLog(true, true, true, true, true);
int colTime = cursor.getColumnIndex("time");
int colVersion = cursor.getColumnIndex("version");
int colProtocol = cursor.getColumnIndex("protocol");
int colFlags = cursor.getColumnIndex("flags");
int colSAddr = cursor.getColumnIndex("saddr");
int colSPort = cursor.getColumnIndex("sport");
int colDAddr = cursor.getColumnIndex("daddr");
int colDPort = cursor.getColumnIndex("dport");
int colDName = cursor.getColumnIndex("dname");
int colUid = cursor.getColumnIndex("uid");
int colData = cursor.getColumnIndex("data");
int colAllowed = cursor.getColumnIndex("allowed");
int colConnection = cursor.getColumnIndex("connection");
int colInteractive = cursor.getColumnIndex("interactive");
DateFormat format = SimpleDateFormat.getDateTimeInstance();
int count = 0;
while (cursor.moveToNext() && ++count < 250) {
sb.append(format.format(cursor.getLong(colTime)));
sb.append(" v").append(cursor.getInt(colVersion));
sb.append(" p").append(cursor.getInt(colProtocol));
sb.append(' ').append(cursor.getString(colFlags));
sb.append(' ').append(cursor.getString(colSAddr));
sb.append('/').append(cursor.getInt(colSPort));
sb.append(" > ").append(cursor.getString(colDAddr));
sb.append('/').append(cursor.getString(colDName));
sb.append('/').append(cursor.getInt(colDPort));
sb.append(" u").append(cursor.getInt(colUid));
sb.append(" a").append(cursor.getInt(colAllowed));
sb.append(" c").append(cursor.getInt(colConnection));
sb.append(" i").append(cursor.getInt(colInteractive));
sb.append(' ').append(cursor.getString(colData));
sb.append("\r\n");
}
cursor.close();
return sb;
}
示例5: updateViews
import java.text.SimpleDateFormat; //导入方法依赖的package包/类
private void updateViews() {
setFieldsEditable(mode == Mode.EDITING);
// Errors
loaderError.setVisibility(View.GONE);
watcherError.setVisibility(View.GONE);
// Input values
watcherName.setText(watcher.getName());
watcherMovieID.setText(watcher.getMovieID() == null ? "" : String.valueOf(watcher.getMovieID()));
String foundCinema = "";
if(cinemas != null) {
for(Cinema cinema : cinemas) {
if(cinema.getID().equals(watcher.getFilters().getCinemaID())) {
foundCinema = cinema.getName();
}
}
}
if(foundCinema.equals("")) { // We don't know this cinema ID's display name
foundCinema = watcher.getFilters().getCinemaID();
}
watcherCinemaID.setText(foundCinema);
autocompleteSuggestion.setVisibility((mode == Mode.EDITING && settings.getInt("prefAutocompleteLocation", -1) == -1) ? View.VISIBLE : View.GONE);
DateFormat format = SimpleDateFormat.getDateTimeInstance(java.text.DateFormat.MEDIUM, java.text.DateFormat.SHORT);
begin.setValue(format.format(new Date(watcher.getBegin())));
end.setValue(format.format(new Date(watcher.getEnd())));
filterStartAfter.setValue(format.format(new Date(watcher.getFilters().getStartAfter())));
filterStartBefore.setValue(format.format(new Date(watcher.getFilters().getStartBefore())));
updateViewsFilters();
// Buttons
if(toolbar != null && toolbar.getMenu() != null && watcher != null && settings != null) {
for(int i = 0; i < toolbar.getMenu().size(); i++) {
if(toolbar.getMenu().getItem(i).getItemId() == R.id.watcherMenuShare || toolbar.getMenu().getItem(i).getItemId() == R.id.watcherMenuDuplicate) {
toolbar.getMenu().getItem(i).setVisible(mode == Mode.VIEWING && id != null);
} else if(toolbar.getMenu().getItem(i).getItemId() == R.id.watcherMenuDelete) {
toolbar.getMenu().getItem(i).setVisible(id != null && !id.equals("") && watcher.getUserID() != null
&& watcher.getUserID().equals(settings.getString("userID", "")));
}
}
}
fab.setImageResource(mode == Mode.EDITING ? R.drawable.ic_save : R.drawable.ic_edit);
}