Java Date to String date2str(Calendar c)

Here you can find the source of date2str(Calendar c)

Description

datestr

License

Open Source License

Declaration

static private String date2str(Calendar c) 

Method Source Code


//package com.java2s;
/*//from  w w  w  .  j av  a2 s . co m
 * IRIS -- Intelligent Roadway Information System
 * Copyright (C) 2009-2016  Minnesota Department of Transportation
 * Copyright (C) 2014-2015  AHMCT, University of California
 * Copyright (C) 2016       California Department of Transportation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

import java.text.SimpleDateFormat;

import java.util.Calendar;

public class Main {
    private final static String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss Z";

    static private String date2str(Calendar c) {
        return new SimpleDateFormat(DATE_FORMAT).format(c.getTime());
    }
}

Related

  1. convertToString(Date date)
  2. ConvertToString(Date date, String format)
  3. convertToString(Date date, String style)
  4. convertToString(java.util.Date date)
  5. convertToString(String format, Date date)
  6. date2Str(Calendar c, String format)
  7. date2Str(Date aDate)
  8. date2Str(Date date)
  9. Date2Str(Date date)