Java Date to Time getXSDDateTime()

Here you can find the source of getXSDDateTime()

Description

get XSD Date Time

License

Open Source License

Return

The dateTime in xsd format with timezone.

Declaration

public static String getXSDDateTime() 

Method Source Code

//package com.java2s;
/**//from  w w w .  j  a v a2  s . c  o  m
 * Copyright (C) 2011 STI Innsbruck, UIBK
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 */

import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**
     * @return The dateTime in xsd format with timezone.
     */
    public static String getXSDDateTime() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
        return simpleDateFormat.format(new Date());
    }
}

Related

  1. getTimeString(Date d)
  2. getTimeString(Date date)
  3. getTimeString(Date self)
  4. getTimeString(java.util.Date date)
  5. getTimeText(Date date)
  6. getXsdDateTime(Date time)
  7. getXsdDateTime(final Date d)
  8. removeTime(Date date)
  9. serializeDateTime(final Date date)