Java Date to Time getXsdDateTime(final Date d)

Here you can find the source of getXsdDateTime(final Date d)

Description

get Xsd Date Time

License

Open Source License

Declaration

public static String getXsdDateTime(final Date d) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2013, 2014, 2015 QPark Consulting S.a r.l. This program and the
 * accompanying materials are made available under the terms of the Eclipse
 * Public License v1.0. The Eclipse Public License is available at
 * http://www.eclipse.org/legal/epl-v10.html.
 ******************************************************************************/

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static String getXsdDateTime(final Date d) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
        if (d != null) {
            return sdf.format(d);
        } else {//from w  ww  . java  2s.  c  o  m
            return sdf.format(new Date());
        }
    }
}

Related

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