Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    /**
     * Convert Date to String - For Audio Record FileName ONLY
     * @param date
     * @param format
     * @return
     */
    public static String convertDateToStrForAudioFileName() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.ENGLISH);
        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT+0000"));
        String dateStr = dateFormat.format(new Date());
        return dateStr;
    }
}