当前位置: 首页>>代码示例>>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;未经允许,请勿转载。