Java Calendar to String calendarToSiteDataString(final Calendar cal)

Here you can find the source of calendarToSiteDataString(final Calendar cal)

Description

Returns calendar as a formatted String (yyyy-MM-dd HH:mm:ss'Z')

License

Apache License

Parameter

Parameter Description
cal The calendar input to be converted to a date time string

Return

The formatted date time string

Declaration

public static String calendarToSiteDataString(final Calendar cal) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class Main {
    private static final SimpleDateFormat SIMPLE_DATE_FORMATTER2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss'Z'");

    /**//from  w w w  .  j a v a 2  s  .  c  o m
     * Returns calendar as a formatted String (yyyy-MM-dd HH:mm:ss'Z')
     *
     * @param cal The calendar input to be converted to a date time string
     * @return The formatted date time string
     */
    public static String calendarToSiteDataString(final Calendar cal) {
        return SIMPLE_DATE_FORMATTER2.format(new Date(cal.getTimeInMillis()));
    }
}

Related

  1. calendar2string(Calendar calendar, String formatString)
  2. calendarDateToStrFormatddMMMyy(final Calendar cal)
  3. calendarOutput(Calendar date)
  4. calendarParaString(Calendar cal)
  5. calendarToIso(Calendar c)
  6. calendarToStorageRoomTimeString(Calendar cal)
  7. calendarToString(Calendar c)
  8. calendarToString(Calendar c, String format)
  9. calendarToString(Calendar cal)