小编Rus*_*ear的帖子

如何获取默认的日期和时间格式模式

有人可以告诉我如何获取指定区域设置(或默认区域设置)的默认日期和时间格式模式(String).

我已经找到的(可能对其他人有用):

  1. 如何获取默认语言环境.

    Locale currentLocale= Locale.getDefault();
    System.out.print(currentLocale.toString());
    
    Result is "en_US"
    
    Run Code Online (Sandbox Code Playgroud)
  2. 如何获得小数分隔符.

    DecimalFormatSymbols decimalFormatSymbols =
                                         new DecimalFormatSymbols(currentLocale);
    System.out.print(decimalFormatSymbols.getDecimalSeparator());
    
    Result is "."
    
    Run Code Online (Sandbox Code Playgroud)
  3. 如何获取默认的日期和时间格式模式(String);

    (do something)
    System.out.print(something);
    And got at output something like this: "dd/mm/yyyy" or "hh:mm:ss".. 
                                 or other values for specified locale.
    
    Run Code Online (Sandbox Code Playgroud)

非常感谢.

UPD: 找到解决方案:

SimpleDateFormat simpleDateFormat = new SimpleDateFormat();
String dateLocalizedFormatPattern = simpleDateFormat.toLocalizedPattern();

The result of System.out.print(dateLocalizedFormatPattern) 
                                             on my device is "M/d/yy h:mm a".
Run Code Online (Sandbox Code Playgroud)

java android

8
推荐指数
1
解决办法
2万
查看次数

Premake4实用程序和应用程序入口点

我使用premake4.exe实用程序为不同的平台生成项目文件.问题是我找不到如何在lua-config文件中指定自定义应用程序入口点.

我应该使用哪个选项?例如,在Visual Studio中我可以去

Project Properties->Linker->Advanced
Entry Point  = name_of_my_entry_point_function
Run Code Online (Sandbox Code Playgroud)

在premake4手册(http://industriousone.com/flags)中,我发现只有WinMain()标志将WinMain函数确定为应用程序入口点,但我需要自定义入口点,例如像wmain().

c++ lua visual-studio-2010 premake

3
推荐指数
1
解决办法
401
查看次数

标签 统计

android ×1

c++ ×1

java ×1

lua ×1

premake ×1

visual-studio-2010 ×1