Java Date Now getCurrentDateINYYYY_MM_DD()

Here you can find the source of getCurrentDateINYYYY_MM_DD()

Description

get Current Date INYYYMDD

License

Apache License

Return

the current date in YYYY_MM_DD format

Declaration

public static String getCurrentDateINYYYY_MM_DD() 

Method Source Code


//package com.java2s;
/*//from  www . ja v  a2s.c o m
 *    Copyright 2016 Roche NimbleGen Inc.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

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

public class Main {
    /**
     * @return the current date in YYYY_MM_DD format
     */
    public static String getCurrentDateINYYYY_MM_DD() {
        return convertTimeInMillisecondsToDateInYYY_MM_DD(System.currentTimeMillis());
    }

    /**
     * 
     * @param timeInMilliseconds
     * @return the date provided by timeInMilliseconds in YYYY_MM_DD_HH_MM_SS format
     */
    public static String convertTimeInMillisecondsToDateInYYY_MM_DD(long timeInMilliseconds) {
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
        Date date = new Date(timeInMilliseconds);
        return dateFormat.format(date);
    }
}

Related

  1. getCurrentDateDBFormat()
  2. getCurrentDateFormat()
  3. getCurrentDateFormated()
  4. getCurrentDateInMillis()
  5. getCurrentDateInSqlFormat()
  6. getCurrentDateInyyyyMMddFormat()
  7. getCurrentDateINYYYYMMDDHHMMSSwithColons()
  8. getCurrentDateMMDDYYYY()
  9. getCurrentDateSlashStr()