Hello,
 
I needed new function for datetime formatting to be able to add current
datetime to file/directory name. Normal to-string coudn't be used, since it
produce string with ':' and '/' characters.
 
Implementation is very simple (below). Here is example of use for new
function:
 
datetime::format-to-string(datetime::now(),'yyyyMMddHHmmss') 
 
 
Martin
 
--
 
Here is the function:
        /// <summary>
        /// Converts the specified <see cref="DateTime" /> to its equivalent
        /// string representation.
        /// </summary>
        /// <param name="value">A <see cref="DateTime" /> to
convert.</param>
        /// <param name="format">A format string.</param>
        /// <returns>
        /// A string representation of <paramref name="value" /> formatted
     /// using the specified format
        /// </returns>
        /// <remarks>
        /// <paramref name="value" /> is formatted with the 
        /// <see cref="DateTimeFormatInfo" /> for the invariant culture.
        /// </remarks>
        [Function("format-to-string")]
        public static string ToString(DateTime value,string format) {
            return value.ToString(format, CultureInfo.InvariantCulture);
        }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to