Java Now now_TimeZone_BY()

Here you can find the source of now_TimeZone_BY()

Description

no Time ZonBY

License

Open Source License

Declaration

public static synchronized String now_TimeZone_BY() 

Method Source Code


//package com.java2s;
/*/*from  ww  w .j  a  v  a2  s.  c o m*/
 * Copyleft 2013
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

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

public class Main {
    public static final String DATE_FORMAT_NOW = "[dd MMMMM yyyy aaa hh:mm:ss.SSS z]";
    public static final Locale DATE_LOCALE = Locale.UK;
    public static final String TIME_ZONE_BELARUS = "GMT+3:00";

    public static synchronized String now_TimeZone_BY() {
        setBelarusTimeZone();
        String result = new SimpleDateFormat(DATE_FORMAT_NOW, DATE_LOCALE).format(Calendar.getInstance().getTime());

        return result;
    }

    public static void setBelarusTimeZone() {
        TimeZone.setDefault(TimeZone.getTimeZone(TIME_ZONE_BELARUS));
    }
}

Related

  1. now(String dateFormat)
  2. now(String dateFormat)
  3. now(String formatStr)
  4. now(String pattern)
  5. now(String s, Date date)
  6. nowAs14CharString()
  7. nowAsAnsiDate()
  8. nowAsString()
  9. nowAsXSDDateTimeString()