How to determine date pattern for a Webi document using Java RE SDK

...

// Determine preferred locale for the user
Locale locale = null;
try {
    IUserInfo userInfo;
    try {
        userInfo = enterpriseSession.getUserInfo();
    }
    catch (SDKException e) {
        userInfo = null;
    }
    if (null != userInfo) {
        try {
            if (userInfo.getPreferredViewingLocale() != null) {
                locale = userInfo.getPreferredViewingLocale();
            }
        }
        catch (SDKException.PropertyNotFound e) {
            locale = Locale.getDefault();
        }
    }
    System.out.println("Locale: " + locale);
}
catch(Exception e) {
    System.out.println(e.toString());
}
if (locale != null) {
    // Open the document
    OpenDocumentParameters odp = new OpenDocumentParameters(-1, true, false);
    odp.getMultilingualOptions().enableMultilingual(locale.toString());
    DocumentInstance doc = reportEngine.openDocument(infoObject.getID(), odp);

    // Determine the pattern
    FormatNumber formatNumber = doc.getDefaultFormatNumber(FormatNumberType.DATE_TIME);
    System.out.println("Date pattern: " + formatNumber.getPositive());

    // Close the document
    doc.closeDocument();
}