當前位置: 首頁>>代碼示例>>Java>>正文


Java Locale.US屬性代碼示例

本文整理匯總了Java中java.util.Locale.US屬性的典型用法代碼示例。如果您正苦於以下問題:Java Locale.US屬性的具體用法?Java Locale.US怎麽用?Java Locale.US使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.util.Locale的用法示例。


在下文中一共展示了Locale.US屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setDate

/**
 * Set a parameter to a java.sql.Date value. The driver converts this to a
 * SQL DATE value when it sends it to the database.
 * 
 * @param parameterIndex
 *            the first parameter is 1, the second is 2, ...
 * @param x
 *            the parameter value
 * @param cal
 *            the calendar to interpret the date with
 * 
 * @exception SQLException
 *                if a database-access error occurs.
 */
public void setDate(int parameterIndex, java.sql.Date x, Calendar cal) throws SQLException {
    if (x == null) {
        setNull(parameterIndex, java.sql.Types.DATE);
    } else {
        if (!this.useLegacyDatetimeCode) {
            newSetDateInternal(parameterIndex, x, cal);
        } else {
            synchronized (checkClosed().getConnectionMutex()) {
                if (this.ddf == null) {
                    this.ddf = new SimpleDateFormat("''yyyy-MM-dd''", Locale.US);
                }
                if (cal != null) {
                    this.ddf.setTimeZone(cal.getTimeZone());
                }

                setInternal(parameterIndex, this.ddf.format(x));

                this.parameterTypes[parameterIndex - 1 + getParameterIndexOffset()] = Types.DATE;
            }
        }
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:36,代碼來源:PreparedStatement.java

示例2: newSetDateInternal

private void newSetDateInternal(int parameterIndex, Date x, Calendar targetCalendar) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (this.ddf == null) {
            this.ddf = new SimpleDateFormat("''yyyy-MM-dd''", Locale.US);
        }

        if (targetCalendar != null) {
            this.ddf.setTimeZone(targetCalendar.getTimeZone());
        } else if (this.connection.getNoTimezoneConversionForDateType()) {
            this.ddf.setTimeZone(this.connection.getDefaultTimeZone());
        } else {
            this.ddf.setTimeZone(this.connection.getServerTimezoneTZ());
        }

        setInternal(parameterIndex, this.ddf.format(x));
    }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:PreparedStatement.java

示例3: doubleToString

/**
 * Locale-dependently converts a double into a string.
 *
 * @param decimal a double
 * @return the user's locale's representation of the given double
 */
private static String doubleToString(final double decimal) {
    final Locale locale = Locale.US;
    final NumberFormat formatter = NumberFormat.getInstance(locale);

    return formatter.format(decimal);
}
 
開發者ID:FWDekker,項目名稱:intellij-randomness,代碼行數:12,代碼來源:DecimalSettingsDialogTest.java

示例4: formatDate

private static String formatDate(String rawDate) {
        String jsonDatePattern = "yyyy-MM-dd'T'HH:mm:ss'Z'";
        SimpleDateFormat jsonFormatter = new SimpleDateFormat(jsonDatePattern, Locale.US);
        try {
            Date parsedJsonDate = jsonFormatter.parse(rawDate);
            String finalDatePattern = "MMM d, yyy";
            SimpleDateFormat finalDateFormatter = new SimpleDateFormat(finalDatePattern, Locale.US);
            return finalDateFormatter.format(parsedJsonDate);
        } catch (ParseException e) {
            Log.e("QueryUtils", "Error parsing JSON date: ", e);
            return "";
        }
}
 
開發者ID:cdc03819,項目名稱:BrewBook,代碼行數:13,代碼來源:QueryUtils.java

示例5: getFormat

public SimpleDateFormat getFormat() {
    String format = getProperty(OTAConfig.VERSION_FORMAT, "");
    if (format.isEmpty()) {
        return null;
    }

    try {
        return new SimpleDateFormat(format, Locale.US);
    } catch (IllegalArgumentException | NullPointerException e) {
        OTAUtils.logError(e);
    }
    return null;
}
 
開發者ID:DroidThug,項目名稱:VulcanOTA,代碼行數:13,代碼來源:OTAConfig.java

示例6: getDateCompartor

static Comparator<UserNote> getDateCompartor() {
    return (o1, o2) -> {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
        try {
            return sdf.parse(o1.timeStampString).compareTo(sdf.parse(o2.timeStampString));
        } catch (ParseException e) {
            e.printStackTrace();
            return 0;
        }
    };
}
 
開發者ID:fekracomputers,項目名稱:IslamicLibraryAndroid,代碼行數:11,代碼來源:UserNote.java

示例7: initialValue

@Override
protected SimpleDateFormat[] initialValue() {
    return new SimpleDateFormat[] {
        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US),
        new SimpleDateFormat("EEEEEE, dd-MMM-yy HH:mm:ss zzz", Locale.US),
        new SimpleDateFormat("EEE MMMM d HH:mm:ss yyyy", Locale.US)
    };
    
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:9,代碼來源:RemoteIpFilter.java

示例8: newSetTimeInternal

private void newSetTimeInternal(int parameterIndex, Time x, Calendar targetCalendar) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        if (this.tdf == null) {
            this.tdf = new SimpleDateFormat("''HH:mm:ss''", Locale.US);
        }

        if (targetCalendar != null) {
            this.tdf.setTimeZone(targetCalendar.getTimeZone());
        } else {
            this.tdf.setTimeZone(this.connection.getServerTimezoneTZ());
        }

        setInternal(parameterIndex, this.tdf.format(x));
    }
}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:15,代碼來源:PreparedStatement.java

示例9: toString

@Override
public String toString() {
    StringBuilder sb = new StringBuilder();
    Formatter f = new Formatter(sb, Locale.US);
    f.format("=== Types ===%n");
    f.format("%s%n", types.toString());
    f.format("=== Methods ===%n");
    f.format("%s%n", methods.toString());
    f.format("=== Fields ===%n");
    f.format("%s%n", fields.toString());
    return sb.toString();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:DeprDB.java

示例10: initialValue

protected DateFormat initialValue() {
    DateFormat df =
        new SimpleDateFormat(OLD_COOKIE_PATTERN, Locale.US);
    df.setTimeZone(TimeZone.getTimeZone("GMT"));
    return df;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:6,代碼來源:ServerCookie.java

示例11: send

/**
 * Sends given response to the socket.
 */
private void send(OutputStream outputStream) {
    String mime = mimeType;
    SimpleDateFormat gmtFrmt = new SimpleDateFormat(
            "E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
    gmtFrmt.setTimeZone(TimeZone.getTimeZone("GMT"));

    try {
        if (status == null) {
            throw new Error("sendResponse(): Status can't be null.");
        }
        PrintWriter pw = new PrintWriter(outputStream);
        pw.print("HTTP/1.0 " + status.getDescription() + " \r\n");

        if (mime != null) {
            pw.print("Content-Type: " + mime + "\r\n");
        }

        if (header == null || header.get("Date") == null) {
            pw.print("Date: " + gmtFrmt.format(new Date()) + "\r\n");
        }

        if (header != null) {
            for (String key : header.keySet()) {
                String value = header.get(key);
                pw.print(key + ": " + value + "\r\n");
            }
        }

        pw.print("\r\n");
        pw.flush();

        if (data != null) {
            int pending = data.available(); // This is to support
            // partial sends, see
            // serveFile()
            int BUFFER_SIZE = 16 * 1024;
            byte[] buff = new byte[BUFFER_SIZE];
            while (pending > 0) {
                int read = data.read(buff, 0,
                        ((pending > BUFFER_SIZE) ? BUFFER_SIZE
                                : pending));
                if (read <= 0) {
                    break;
                }
                outputStream.write(buff, 0, read);
                pending -= read;
            }
        }
        outputStream.flush();
        outputStream.close();
        if (data != null)
            data.close();
    } catch (IOException ioe) {
        // Couldn't write? No can do.
    }
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:59,代碼來源:NanoHTTPD.java

示例12: getTimeFormat

public static DateFormat getTimeFormat() {
	return new SimpleDateFormat(TIME_FORMAT_PATTERN, Locale.US);
}
 
開發者ID:holon-platform,項目名稱:holon-jaxrs,代碼行數:3,代碼來源:FormDataFormats.java

示例13: Logger

protected Logger() {
    mDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US);
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:3,代碼來源:Logger.java

示例14: main

public static void main(String[] a) throws Exception {
//    DRBackendTidsformater.servertidsformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US); // +01:00 springes over da kolon i +01:00 er ikke-standard Java
    parseUpålideigtServertidsformat("2014-02-13T10:03:00+01:00");
    DRBackendTidsformater.servertidsformat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz", Locale.US); // +01:00 springes over da kolon i +01:00 er ikke-standard Java
    System.out.println("res = "+ parseUpålideigtServertidsformat("2017-03-27T04:00:35+0000"));
  }
 
開發者ID:nordfalk,項目名稱:EsperantoRadio,代碼行數:6,代碼來源:DRBackendTidsformater.java

示例15: initialValue

@Override
public DateFormat initialValue() {
    DateFormat result = new SimpleDateFormat(asctimePattern, Locale.US);
    result.setTimeZone(GMT_ZONE);
    return result;
}
 
開發者ID:liaokailin,項目名稱:tomcat7,代碼行數:6,代碼來源:DateTool.java


注:本文中的java.util.Locale.US屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。