Creates a SimpleDateFormat with the UK locale.
517357
public static DateFormat createFormatter(String str) {
        DateFormat df = new SimpleDateFormat(str, Locale.UK);
        df.setTimeZone(UTC);
        return df;
    }
419965
public static void formatLatitude(Appendable out, Locale locale, double latitude, UnitType unit)
    {
        format(out, locale, latitude, unit, NS);
    }
183386
public static String selectMomentJSDateTimeFormat(Locale locale, String momentJSFormat, boolean withDate, boolean withTime) {
		if (momentJSFormat == null) {
			String dateFormat = "";
			if (withDate) {
				dateFormat = ((SimpleDateFormat) DateFormat.getDateInstance(DateFormat.SHORT, locale)).toPattern();
			}
			String timeFormat = "";
			if (withTime) {
				timeFormat = ((SimpleDateFormat)DateFormat.getTimeInstance(DateFormat.MEDIUM, locale)).toPattern();
			}
			// Since DateFormat.SHORT is silly, return a smart format
			if (dateFormat.equals("M/d/yy")) {
				dateFormat = "MM/dd/yyyy";
			}
			else if (dateFormat.equals("d/M/yy")) {
				dateFormat = "dd/MM/yyyy";
			}
			String result = LocaleUtils.javaToMomentFormat((dateFormat + " " + timeFormat).trim());
//			System.out.println(result);
			return result;
		} else {
			return momentJSFormat;
		}
	}
727921
public static String formatDate(Long timestamp, String format, Locale loc) {
		if (StringUtils.isBlank(format)) {
			format = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.getPattern();
		}
		if (timestamp == null) {
			timestamp = timestamp();
		}
		if (loc == null) {
			loc = Locale.US;
		}
		return DateFormatUtils.format(timestamp, format, loc);
	}
225399
public static Date getDay(String string) {
		if (string == null) {
			return null;
		}
		Locale.setDefault(Locale.UK);
		Date date = null;
		try {
			date = ((SimpleDateFormat)dateMonYear.clone()).parse(string);
		}
		catch (ParseException ex) {
			return null;
		}
		return date;
	}
950408
public static String formatDate(final Date value, final String pattern)
    {
        return new SimpleDateFormat(pattern, currentLocale()).format(value);
    }
1274678
private static String formatDate(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss'Z'");
        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
        return formatter.format(date);
    }
940561
public PrettyTime setLocale(Locale locale)
   {
      if (locale == null)
         locale = Locale.getDefault();

      this.locale = locale;
      for (TimeUnit unit : units.keySet()) {
         if (unit instanceof LocaleAware)
            ((LocaleAware<?>) unit).setLocale(locale);
      }
      for (TimeFormat format : units.values()) {
         if (format instanceof LocaleAware)
            ((LocaleAware<?>) format).setLocale(locale);
      }
      return this;
   }
828289
protected DateFormat getDateTimeFormat( final Locale browserLocale )
    {
        return SimpleDateFormat.getDateTimeInstance( SimpleDateFormat.SHORT, SimpleDateFormat.MEDIUM, browserLocale );
    }
536198
private static SimpleDateFormat createDateFormat(String pattern, EUniCalendar calendar) {
		return createDateFormat(pattern, calendar, getDefault());
	}
707798
public static String fromUnixtime(long unixtime, String format, TimeZone tz) {
		SimpleDateFormat formatter = FORMATTER_CACHE.get(format);
		formatter.setTimeZone(tz);
		Date date = new Date(unixtime * 1000);
		try {
			return formatter.format(date);
		} catch (Exception e) {
			LOG.error("Exception when formatting.", e);
			return null;
		}
	}
835325
def format(date, now=None, locale='en'):
    '''
    
    '''
    if not isinstance(date, timedelta):
        if now is None:
            now = datetime.now()
        date = parser.parse(date)
        now = parser.parse(now)

        if date is None:
            raise ParameterUnvalid('the parameter `date` should be datetime '
                                   '/ timedelta, or datetime formated string.')
        if now is None:
            raise ParameterUnvalid('the parameter `now` should be datetime, '
                                   'or datetime formated string.')
        date = now - date
    # the gap sec
    diff_seconds = int(total_seconds(date))

    # is ago or in
    ago_in = 0
    if diff_seconds < 0:
        ago_in = 1  # date is later then now, is the time in future
        diff_seconds *= -1  # chango to positive

    tmp = 0
    i = 0
    while i < SEC_ARRAY_LEN:
        tmp = SEC_ARRAY[i]
        if diff_seconds >= tmp:
            i += 1
            diff_seconds /= tmp
        else:
            break
    diff_seconds = int(diff_seconds)
    i *= 2

    if diff_seconds > (i == 0 and 9 or 1):
        i += 1

    if locale is None:
        locale = DEFAULT_LOCALE

    tmp = timeago_template(locale, i, ago_in)
    if hasattr(tmp, '__call__'):
        tmp = tmp(diff_seconds)
    return '%s' in tmp and tmp % diff_seconds or tmp
192832
protected DateFormat getDateTimeFormat( Locale browserLocale ) {
        return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, browserLocale);
    }
1009379
def _generate_timezone(date, local_tz):
    
    offset = _calculate_offset(date, local_tz)

    hour = abs(offset) // 3600
    minute = abs(offset) % 3600 // 60

    if offset < 0:
        return '%c%02d:%02d' % ("-", hour, minute)
    else:
        return '%c%02d:%02d' % ("+", hour, minute)
225888
public CellFormatResult format(final String formatPattern, final Date value, final Locale locale) {
        return format(new DateCell(value, formatPattern), locale);
    }
1176081
public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, Locale loc) {
        return formatHelper(this, ULocale.forLocale(loc), dateStyle, timeStyle);
    }
1007761
def format_as_utc(self, value):
        """"""
        if isinstance(value, datetime.datetime):
            if value.tzinfo is not None:
                value = value.astimezone(pytz.UTC)
            value = value.replace(microsecond=0)
        return value.isoformat().replace('+00:00', 'Z')