当前位置: 首页>>代码示例>>Java>>正文


Java Format.format方法代码示例

本文整理汇总了Java中java.text.Format.format方法的典型用法代码示例。如果您正苦于以下问题:Java Format.format方法的具体用法?Java Format.format怎么用?Java Format.format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.text.Format的用法示例。


在下文中一共展示了Format.format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mbushNgaStatusi

import java.text.Format; //导入方法依赖的package包/类
public void mbushNgaStatusi(String emri){
    try {
        String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        String s = "";
        while (rs.next()) {
            s = format.format(rs.getDate("data"));
            data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
                    rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
        }

        rs.close();
        stmt.close();
        conn.close();
        table.setItems(data);
    }catch (Exception ex){ex.printStackTrace();}
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:22,代码来源:ShikoPunetPunetoret.java

示例2: mbushPunetoret

import java.text.Format; //导入方法依赖的package包/类
public void mbushPunetoret(){
    try {
        String sql = "select * from Punetoret";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaPunetoret> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        while (rs.next()){
            String s = format.format(rs.getDate("regjistrimi"));
            data.add(new TabelaPunetoret(rs.getInt("id"), rs.getString("emri"),
                    rs.getString("mbiemri"), rs.getString("komuna"), rs.getString("pozita"),
                    s, rs.getFloat("paga")));
        }

        table.setItems(data);
        conn.close();
    }catch (Exception ex){ex.printStackTrace();}
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:20,代码来源:ShikoPunetoret.java

示例3: mbush

import java.text.Format; //导入方法依赖的package包/类
public void mbush(String emri){
    Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
            try {
                String sql = "select * from Punet where punetori = '" + emri + "' order by id asc";
                Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
                Statement stmt = conn.createStatement();
                ResultSet rs = stmt.executeQuery(sql);
                ObservableList<TabelaTeDhenatPunetore> data = FXCollections.observableArrayList();
                Format format = new SimpleDateFormat("dd/MM/yyyy");
                String s = "";
                while (rs.next()) {
                    s = format.format(rs.getDate("data"));
                    data.add(new TabelaTeDhenatPunetore(rs.getInt("id"), rs.getString("lloji"), s,
                            rs.getFloat("qmimi"), rs.getString("konsumatori"), rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina")));
                }

                rs.close();
                stmt.close();
                conn.close();
                table.setItems(data);
            }catch (Exception ex){ex.printStackTrace();}
        }
    });
    t.start();
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:28,代码来源:ShikoPunetPunetoret.java

示例4: findAll

import java.text.Format; //导入方法依赖的package包/类
/**
 * Call a Fortify REST service to fetch items by their name.<br>
 * NOTE : process manager will be shut down.
 * 
 * @param node
 *            node to query.
 * @param url
 *            query URL.
 * @param criteria
 *            Optional name to match.
 * @return Projects matching to the given criteria.
 */
private Collection<FortifyProject> findAll(final String node, final String url, final String criteria)
		throws IOException {
	// Check the user can log-in to Fortify
	final Collection<Map<String, Object>> data = getFortifyResource(this.pvResource.getNodeParameters(node),
			url);
	final Format format = new NormalizeFormat();
	final String formatCriteria = format.format(StringUtils.trimToEmpty(criteria));

	// Filter by criteria on the project name
	final Map<Integer, FortifyProject> result = new TreeMap<>();
	data.stream().filter(item -> (format.format(item.get("name"))).contains(formatCriteria)).forEach(item -> {
		final FortifyProject entry = toProject(item);
		result.put(entry.getId(), entry);
	});
	return result.values();
}
 
开发者ID:ligoj,项目名称:plugin-security-fortify,代码行数:29,代码来源:FortifyPluginResource.java

示例5: getLastMessageTime

import java.text.Format; //导入方法依赖的package包/类
public String getLastMessageTime() {
    SimpleDateFormat localDateFormat = new SimpleDateFormat("HH:mm");
    Format formatter = new SimpleDateFormat("dd/MM/yy");
    Date dt = new Date(lastMessageDateSent * 1000);

    String now = formatter.format(new Date());
    String messageDate = formatter.format(dt);
    if (now.equals(messageDate)) {
        return localDateFormat.format(dt).toString();
    } else if (lastMessageDateSent == 0) {
        return "";
    } else {
        return messageDate;
    }
}
 
开发者ID:ukevgen,项目名称:BizareChat,代码行数:16,代码来源:DialogModel.java

示例6: extracted

import java.text.Format; //导入方法依赖的package包/类
private void extracted(final Map<Integer, String> allStatus, final String originalStatus,
		final Set<Integer> targetIndentifiers) {
	final Format format = new NormalizeFormat();
	final String text = format.format(originalStatus);
	for (final Entry<Integer, String> status : allStatus.entrySet()) {
		if (format.format(status.getValue()).equals(text)) {
			targetIndentifiers.add(status.getKey());
		}
	}
}
 
开发者ID:ligoj,项目名称:plugin-bt,代码行数:11,代码来源:IdentifierHelper.java

示例7: convertTime

import java.text.Format; //导入方法依赖的package包/类
private String convertTime(Long time) {
    if (time != null) {
        Date date = new Date(time);
        Format format = new SimpleDateFormat("yyyy MM dd HH:mm:ss");
        return format.format(date);
    } else {
        return "null";
    }
}
 
开发者ID:IBMStreams,项目名称:streamsx.jmxclients,代码行数:10,代码来源:StreamsInstanceTracker.java

示例8: listToStringList

import java.text.Format; //导入方法依赖的package包/类
private List<String> listToStringList(List<?> list, Format formatter) {
	// Prepare to store floating-points as a list of strings.
	List<String> stringScalars = new ArrayList<String>();
	// For each scalar in the buffer, turn it into a string, adding it to the overall list.
	for (Object scalar : list) {
		String scalarAsString = formatter.format(scalar);
		stringScalars.add(scalarAsString);
	}
	return stringScalars;
}
 
开发者ID:shenan4321,项目名称:BIMplatform,代码行数:11,代码来源:ColladaSerializer.java

示例9: setFecha

import java.text.Format; //导入方法依赖的package包/类
public void setFecha(int codigo, Date fecha){ 
    Format formato = new SimpleDateFormat("yyyy-MM-dd");
    String fstring;
    fstring = formato.format(fecha);

    try{
        stmt.executeUpdate("UPDATE testd SET fecha='"+fstring+"' WHERE codigo="+codigo);
    }

    catch(SQLException e){
        System.out.println("No se actualizo la fecha");
    }  
}
 
开发者ID:LetyM,项目名称:nihonGO,代码行数:14,代码来源:DatabaseHandler.java

示例10: test_toFormat_format

import java.text.Format; //导入方法依赖的package包/类
@Test
public void test_toFormat_format() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    Format format = test.toFormat();
    String result = format.format(LocalDate.of(2008, 6, 30));
    assertEquals(result, "ONE30");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TCKDateTimeFormatter.java

示例11: filtroFinancat

import java.text.Format; //导入方法依赖的package包/类
public void filtroFinancat(TextField puna) {
    try {
        String sql;
        if (!puna.getText().isEmpty())
            sql = "select * from Punet where lower(lloji) like lower('%" + puna.getText() + "%') or lower(konsumatori) like lower('%" + puna.getText() + "%'" +
                    ") order by data desc";
        else
            sql = "select * from Punet order by data desc";
        Connection conn = DriverManager.getConnection(CON_STR, "test", "test");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql);
        ObservableList<TabelaPunet> data = FXCollections.observableArrayList();
        Format format = new SimpleDateFormat("dd/MM/yyyy");
        while (rs.next()) {
            String d = format.format(rs.getDate("data"));
            data.add(new TabelaPunet(rs.getInt("id"), rs.getString("lloji").toUpperCase(), d,
                    rs.getFloat("qmimi"), rs.getString("konsumatori").toUpperCase(),
                    rs.getString("pershkrimi"), rs.getString("kryer"), rs.getString("makina").toUpperCase()));
        }
        tblPunet.getItems().clear();
        tblPunet.setItems(data);
        stmt.close();
        rs.close();
        conn.close();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
 
开发者ID:urankajtazaj,项目名称:Automekanik,代码行数:29,代码来源:DritarjaKryesore.java

示例12: format

import java.text.Format; //导入方法依赖的package包/类
/**
 * <p>Format a value with the specified <code>DateFormat</code>.</p>
 *
 * @param value The value to be formatted.
 * @param formatter The Format to use.
 * @return The formatted value.
 */
@Override
protected String format(Object value, Format formatter) {
    if (value == null) {
        return null;
    } else if (value instanceof Calendar) {
        value = ((Calendar)value).getTime();
    }
    return formatter.format(value);
}
 
开发者ID:Ilhasoft,项目名称:data-binding-validator,代码行数:17,代码来源:AbstractCalendarValidator.java

示例13: formatInterestRate

import java.text.Format; //导入方法依赖的package包/类
/**
 * Format an interest rate value.
 *
 * @param pValue
 *            the value
 * @param pLocale
 *            the locale
 * @return the string
 */
protected String formatInterestRate(Number pValue, Locale pLocale) {
    if (pValue == null) {
        return EMPTY_STRING;
    }
    double tRate = asDouble(pValue) / DIVISOR.INTEREST * 100;
    Format tFormat = mFormatters.get(pLocale).get(
            CwfBusinessTypes.InterestRate);
    synchronized (tFormat) {
        return tFormat.format(tRate);
    }
}
 
开发者ID:cinnober,项目名称:ciguan,代码行数:21,代码来源:AsFormat.java

示例14: onTestFailure

import java.text.Format; //导入方法依赖的package包/类
/**
 * Take screenshot in case of test failure.
 */
@Override
public void onTestFailure(ITestResult tr)
{
    super.onTestFailure(tr);

    WebDriver webDriver = findWebDriverByReflection(tr);

    if (webDriver == null)
    {
        LOGGER.debug(String
                .format("The test class '%s' does not have any field of type 'org.openqa.selenium.WebDriver'. "
                        + "ScreenshotTestListener can not continue.", tr.getTestClass().getName()));
        return;
    }

    File f = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE);

    Format formatter = new SimpleDateFormat("dd_MMM_hh_mm_ss");

    String timestamp = formatter.format(new Date());
    String fileName = tr.getTestClass().getRealClass().getSimpleName() + "_" + timestamp + ".png";

    Path screenshotPath = null;

    try
    {
        screenshotPath = Paths.get(currentDir, "target", fileName);

        LOGGER.info("copying failure screenshot file '" + fileName + "' to '" + screenshotPath + "'");

        Files.copy(f.toPath(), screenshotPath, StandardCopyOption.REPLACE_EXISTING);
        Reporter.log("[Console Log] Screenshot saved in " + screenshotPath);
    } catch (IOException e)
    {
        LOGGER.debug("Error during the screenshot copy file operation:" + e.getMessage());
    }
}
 
开发者ID:pradeeptaswain,项目名称:oldmonk,代码行数:41,代码来源:ScreenshotListener.java

示例15: test_toFormat_format_null

import java.text.Format; //导入方法依赖的package包/类
@Test(expectedExceptions=NullPointerException.class)
public void test_toFormat_format_null() throws Exception {
    DateTimeFormatter test = fmt.withLocale(Locale.ENGLISH).withDecimalStyle(DecimalStyle.STANDARD);
    Format format = test.toFormat();
    format.format(null);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:TCKDateTimeFormatter.java


注:本文中的java.text.Format.format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。