Example usage for java.util Date toGMTString

List of usage examples for java.util Date toGMTString

Introduction

In this page you can find the example usage for java.util Date toGMTString.

Prototype

@Deprecated
public String toGMTString() 

Source Link

Document

Creates a string representation of this Date object of the form:
 d mon yyyy hh:mm:ss GMT
where:
  • d is the day of the month ( 1 through 31 ), as one or two decimal digits.

    Usage

    From source file:org.restcomm.app.utillib.Reporters.WebReporter.WebReporter.java

    /**
     * Requests the server to send a Csv to the users email
     * with a 24 hr start-stop time interval
     * @return//from   w  w w .  j  ava2s  .c o  m
     */
    public String requestCsvEmail(int userid, String carrier, int mcc, int mnc, String manufacturer, String model,
            String device, String appname, String apikey) throws Exception {
        SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss");
        Date date = new Date();
        String stoptime = date.toGMTString();
        long startms = date.getTime() - 24 * 3600000;
        Date datestart = new Date(startms);
        String starttime = datestart.toGMTString();
        String parameters = "?userid=" + userid + "&start=" + starttime + "&stop=" + stoptime;
        parameters += "&carrier=" + carrier + "&mcc=" + mcc + "&mnc=" + mnc + "&manuf=" + manufacturer + "&model="
                + model + "&device=" + device + "&email=1";
        parameters += "&appname=" + appname + "&lang=" + DeviceInfo.getLanguageCode() + "&apiKey=" + apikey;
    
        parameters = parameters.replace(" ", "%20");
        String url = Global.getApiUrl(mContext) + "/CoverageData.aspx" + parameters;
        URL request = new URL(url);
        HttpURLConnection connection = (HttpURLConnection) request.openConnection();
        connection.connect();
        String strResponse = readString(connection);
        return strResponse;
    }
    

    From source file:com.betfair.testing.utils.cougar.helpers.CougarHelpers.java

    public String dateInUTC(Date date) {
        if (date == null) {
            return "null";
        }/* w  w w . ja v a 2 s  . co m*/
        return date.toGMTString().replace("GMT", "UTC");
    }
    

    From source file:com.ephesoft.gxt.systemconfig.server.SystemConfigServiceImpl.java

    /**
     * Returns the license details like license expiry date, CPU license count, etc.
     * //from w ww  . j  a va 2 s.  c o m
     * @return {@link Map}<{@link String}, {@link String}>: license details
     */
    @Override
    public Map<String, String> getLicenseDetails() {
        String licenseInfoString = null;
        Map<String, String> licenseDetailMap = null;
    
        LOGGER.debug("License details: ", licenseInfoString);
    
        final String[] licenseDetails = EphesoftStringUtil.splitString(licenseInfoString, CoreCommonConstant.COMMA);
    
        if (null != licenseDetails) {
            int indexOfFirstColon = 0;
            String licensePropertyName = null;
            String licensePropertyValue = null;
            licenseDetailMap = new LinkedHashMap<String, String>(licenseDetails.length);
            for (final String licenseDetail : licenseDetails) {
                indexOfFirstColon = licenseDetail.indexOf(CoreCommonConstant.COLON);
                if ((indexOfFirstColon > 0) && (indexOfFirstColon < licenseDetail.length())) {
                    licensePropertyName = licenseDetail.substring(0, indexOfFirstColon - 1);
                    licensePropertyValue = licenseDetail.substring(indexOfFirstColon + CoreCommonConstant.TWO);
    
                    LOGGER.debug("License Property Name: ", licensePropertyName, "and License Property Value: ",
                            licensePropertyValue);
    
                    if (CoreCommonConstant.EXPIRY_DATE_LICENSE_PROPERTY_NAME
                            .equalsIgnoreCase(licensePropertyName)) {
                        final DateFormat formatter = new SimpleDateFormat(CoreCommonConstant.EXTENDED_DATE_FORMAT);
                        formatter.setTimeZone(TimeZone.getTimeZone(CoreCommonConstant.GMT));
                        try {
                            final Date date = formatter.parse(licensePropertyValue);
                            licensePropertyValue = date.toGMTString();
                        } catch (final ParseException parseException) {
                            LOGGER.error(parseException, "Error while parsing the date",
                                    parseException.getMessage());
                        }
                    }
    
                    if (CoreCommonConstants.ON.equals(licensePropertyValue)
                            || CoreCommonConstants.OFF.equals(licensePropertyValue)) {
                        licensePropertyValue = licensePropertyValue.toUpperCase();
                    }
    
                    if (CoreCommonConstant.MUTLISERVER_SWITCH_LICENSE_PROPERTY_NAME
                            .equalsIgnoreCase(licensePropertyName)) {
                        licensePropertyName = CoreCommonConstant.MUTLISERVER_SWITCH;
                    }
    
                    // Fix for Client Ticket #3340 changed name of advance reporting switch label.
                    if (CoreCommonConstant.ADVANCE_REPORTING_SWITCH_PROPERTY_NAME
                            .equalsIgnoreCase(licensePropertyName)) {
                        licensePropertyName = CoreCommonConstant.ADVANCED_REPORTING_SWITCH;
                    }
    
                    if (CoreCommonConstant.EXPIRY_DATE_MESSAGE_LICENSE_PROPERTY_NAME
                            .equalsIgnoreCase(licensePropertyName)) {
                        licensePropertyName = CoreCommonConstant.LICENSE_EXPIRATION_DISPLAY_MESSGAE;
                        final String[] licensePropertyTokens = EphesoftStringUtil.splitString(licensePropertyValue,
                                CoreCommonConstant.SPACE);
                        if (null != licensePropertyTokens) {
                            licensePropertyValue = EphesoftStringUtil.concatenate(licensePropertyTokens[0],
                                    CoreCommonConstant.SPACE, CoreCommonConstant.DAYS);
                        }
    
                    }
    
                    licenseDetailMap.put(licensePropertyName, licensePropertyValue);
                }
            }
    
            // Removing license failOver value into License detail UI
            // ClusterPropertyService clusterPropertyService =
            // this.getSingleBeanOfType(ClusterPropertyService.class);
            // licensePropertyName =
            // SystemConfigConstants.LICENSE_SERVER_FO_HEADER;
            //
            // ClusterProperty failOverProperty = clusterPropertyService
            // .getClusterPropertyValue(ClusterPropertyType.LICENSE_FAILOVER_MECHANISM);
            // if (null != failOverProperty) {
            // String switchStatus = failOverProperty.getPropertyValue();
            // if (!EphesoftStringUtil.isNullOrEmpty(switchStatus)) {
            // if (CoreCommonConstants.ON.equalsIgnoreCase(switchStatus)) {
            // licensePropertyValue = CoreCommonConstants.ON.toUpperCase();
            // } else {
            // licensePropertyValue = CoreCommonConstants.OFF.toUpperCase();
            // }
            // }
            // }
            // licenseDetailMap.put(licensePropertyName, licensePropertyValue);
        }
        return licenseDetailMap;
    }