Examples of NSTimestampFormatter


Examples of com.webobjects.foundation.NSTimestampFormatter

  /**
   * Returns a shared instance for the specified pattern.
   * @return shared instance of formatter
   */
  public static NSTimestampFormatter dateFormatterForPattern(String pattern) {
    NSTimestampFormatter formatter;
    if(ERXLocalizer.useLocalizedFormatters()) {
      ERXLocalizer localizer = ERXLocalizer.currentLocalizer();
      formatter = (NSTimestampFormatter)localizer.localizedDateFormatForKey(pattern);
    } else {
      synchronized(_repository) {
        formatter = (NSTimestampFormatter)_repository.get(pattern);
        if(formatter == null) {
          formatter = new NSTimestampFormatter(pattern);
          _repository.put(pattern, formatter);
        }
      }
    }
    return formatter;
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

     */
    public ERPublishCalendarPage(WOContext context) {
        super(context);

  events = new NSMutableArray();
  calendarTimeZone = new NSTimestampFormatter ("%Z").format (new NSTimestamp());
  dateTimeFormatter = new NSTimestampFormatter ("%Y%m%dT%H%M%S");
  dateTimeFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone());
  dateFormatter = new NSTimestampFormatter ("%Y%m%d");
  dateFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone());
  utcDateTimeFormatter = new NSTimestampFormatter ("%Y%m%dT%H%M%SZ");
  utcDateTimeFormatter.setDefaultFormatTimeZone (NSTimeZone.timeZoneWithName ("UTC", false));
  timeZoneFormatter = new NSTimestampFormatter ("%Z");
  timeZoneFormatter.setDefaultFormatTimeZone (NSTimeZone.localTimeZone());
    }
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

                        ) {
               
              synchronized(format) {
                ERXSession session = (ERXSession)wocontext.session();
                NSTimeZone zone = NSTimeZone._nstimeZoneWithTimeZone(session.timeZone());
                NSTimestampFormatter tsFormat = (NSTimestampFormatter)format;
                NSTimeZone parseZone = tsFormat.defaultParseTimeZone();
                NSTimeZone formatZone = tsFormat.defaultFormatTimeZone();
                tsFormat.setDefaultFormatTimeZone(zone);
                tsFormat.setDefaultParseTimeZone(zone);
                try {
                  Object parsedObject = format.parseObject(stringValue);
                  String reformatedObject = format.format(parsedObject);
                  result = format.parseObject(reformatedObject);
                } catch(ParseException parseexception) {
                  String keyPath = _value.keyPath();
                  ERXValidationException validationexception = new ERXValidationException(ERXValidationException.InvalidValueException, parseexception, keyPath, stringValue);
                  component.validationFailedWithException(validationexception, stringValue, keyPath);
                  return;
                } finally {
                  tsFormat.setDefaultFormatTimeZone(formatZone);
                  tsFormat.setDefaultParseTimeZone(parseZone);
                }
              }
            } else {
              try {
                Object parsedObject = format.parseObject(stringValue);
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

                ) {
           
          synchronized(format) {
            ERXSession session = (ERXSession)wocontext.session();
            NSTimeZone zone = NSTimeZone._nstimeZoneWithTimeZone(session.timeZone());
            NSTimestampFormatter tsFormat = (NSTimestampFormatter)format;
            NSTimeZone parseZone = tsFormat.defaultParseTimeZone();
            NSTimeZone formatZone = tsFormat.defaultFormatTimeZone();
            tsFormat.setDefaultFormatTimeZone(zone);
            tsFormat.setDefaultParseTimeZone(zone);
            try {
              String formatedValue = format.format(valueInComponent);
              Object reparsedObject = format.parseObject(formatedValue);
              stringValue = format.format(reparsedObject);
            } catch(IllegalArgumentException illegalargumentexception) {
              NSLog._conditionallyLogPrivateException(illegalargumentexception);
              stringValue = null;
            } catch(ParseException parseexception) {
              NSLog._conditionallyLogPrivateException(parseexception);
            } finally {
              tsFormat.setDefaultFormatTimeZone(formatZone);
              tsFormat.setDefaultParseTimeZone(parseZone);
            }
          }
        } else {
          try {
            String formatedValue = format.format(valueInComponent);
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

                        ) {
               
              synchronized(format) {
                ERXSession session = (ERXSession)wocontext.session();
                NSTimeZone zone = NSTimeZone._nstimeZoneWithTimeZone(session.timeZone());
                NSTimestampFormatter tsFormat = (NSTimestampFormatter)format;
                NSTimeZone parseZone = tsFormat.defaultParseTimeZone();
                NSTimeZone formatZone = tsFormat.defaultFormatTimeZone();
                tsFormat.setDefaultFormatTimeZone(zone);
                tsFormat.setDefaultParseTimeZone(zone);
                        try {
                                valueInComponent = format.format(valueInComponent);
                            } catch (IllegalArgumentException ex) {
                                log.info("Exception while formatting", ex);
                                valueInComponent = null;
                            } finally {
                              tsFormat.setDefaultFormatTimeZone(formatZone);
                              tsFormat.setDefaultParseTimeZone(parseZone);
                            }
              }
            } else {
                      try {
                              valueInComponent = format.format(valueInComponent);
View Full Code Here

Examples of com.webobjects.foundation.NSTimestampFormatter

     * @deprecated use {@link ERXTimestampUtilities#gregorianDateFormatterForJavaDate()} instead
     */
    @Deprecated
    public static NSTimestampFormatter gregorianDateFormatterForJavaDate() {
        if (_gregorianDateFormatterForJavaDate == null)
            _gregorianDateFormatterForJavaDate = new NSTimestampFormatter("%a %b %d %H:%M:%S %Z %Y");
        return _gregorianDateFormatterForJavaDate;
    }   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.