< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/lib/ExsltDatetime.java

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Nov 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xalan.internal.lib;
  23 


  28 import java.util.Date;
  29 import java.util.Locale;
  30 import java.util.TimeZone;
  31 
  32 import com.sun.org.apache.xpath.internal.objects.XBoolean;
  33 import com.sun.org.apache.xpath.internal.objects.XNumber;
  34 import com.sun.org.apache.xpath.internal.objects.XObject;
  35 
  36 /**
  37  * This class contains EXSLT dates and times extension functions.
  38  * It is accessed by specifying a namespace URI as follows:
  39  * <pre>
  40  *    xmlns:datetime="http://exslt.org/dates-and-times"
  41  * </pre>
  42  *
  43  * The documentation for each function has been copied from the relevant
  44  * EXSLT Implementer page.
  45  *
  46  * @see <a href="http://www.exslt.org/">EXSLT</a>
  47  * @xsl.usage general

  48  */
  49 
  50 public class ExsltDatetime
  51 {
  52     // Datetime formats (era and zone handled separately).
  53     static final String dt = "yyyy-MM-dd'T'HH:mm:ss";
  54     static final String d = "yyyy-MM-dd";
  55     static final String gym = "yyyy-MM";
  56     static final String gy = "yyyy";
  57     static final String gmd = "--MM-dd";
  58     static final String gm = "--MM--";
  59     static final String gd = "---dd";
  60     static final String t = "HH:mm:ss";
  61     static final String EMPTY_STR = "";
  62 
  63     /**
  64      * The date:date-time function returns the current date and time as a date/time string.
  65      * The date/time string that's returned must be a string in the format defined as the
  66      * lexical representation of xs:dateTime in
  67      * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime">[3.2.7 dateTime]</a> of


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.lib;
  22 


  27 import java.util.Date;
  28 import java.util.Locale;
  29 import java.util.TimeZone;
  30 
  31 import com.sun.org.apache.xpath.internal.objects.XBoolean;
  32 import com.sun.org.apache.xpath.internal.objects.XNumber;
  33 import com.sun.org.apache.xpath.internal.objects.XObject;
  34 
  35 /**
  36  * This class contains EXSLT dates and times extension functions.
  37  * It is accessed by specifying a namespace URI as follows:
  38  * <pre>
  39  *    xmlns:datetime="http://exslt.org/dates-and-times"
  40  * </pre>
  41  *
  42  * The documentation for each function has been copied from the relevant
  43  * EXSLT Implementer page.
  44  *
  45  * @see <a href="http://www.exslt.org/">EXSLT</a>
  46  * @xsl.usage general
  47  * @LastModified: Nov 2017
  48  */
  49 
  50 public class ExsltDatetime
  51 {
  52     // Datetime formats (era and zone handled separately).
  53     static final String dt = "yyyy-MM-dd'T'HH:mm:ss";
  54     static final String d = "yyyy-MM-dd";
  55     static final String gym = "yyyy-MM";
  56     static final String gy = "yyyy";
  57     static final String gmd = "--MM-dd";
  58     static final String gm = "--MM--";
  59     static final String gd = "---dd";
  60     static final String t = "HH:mm:ss";
  61     static final String EMPTY_STR = "";
  62 
  63     /**
  64      * The date:date-time function returns the current date and time as a date/time string.
  65      * The date/time string that's returned must be a string in the format defined as the
  66      * lexical representation of xs:dateTime in
  67      * <a href="http://www.w3.org/TR/xmlschema-2/#dateTime">[3.2.7 dateTime]</a> of


< prev index next >