Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Locale;
import java.util.TimeZone;

public class Main {

    public static String timestamp2String(Timestamp timestamp, String pattern, Locale locale) {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern, locale);
        simpleDateFormat.setTimeZone(TimeZone.getDefault());

        return simpleDateFormat.format(timestamp);
    }
}