Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static SimpleDateFormat serverSideDateFormator = null;

    public static String getTweleveHourTimeWith2DigtYear(String timeToConvert) {
        String convertedTime = "";
        if (timeToConvert == null)
            return null;

        try {
            final Date dateObj = serverSideDateFormator.parse(timeToConvert);
            convertedTime = new SimpleDateFormat("K:mm a MM/dd/yy").format(dateObj);
        } catch (final ParseException e) {
            e.printStackTrace();
        }
        return convertedTime;
    }
}