字符串格式示例:    Oct 27 13:00:01 2009  这种字符串时间格式转化成时间 有没有特定的函数,怎么转?  

解决方案 »

  1.   

    这样的倒是可以:to_date(char,'yyyy-……')
      

  2.   

    你找看看DateTime有没有相关的函数
    好像没有直接处理字符串的
    但是你这个···可以分解吧···
    等高人的回答
      

  3.   

        可以在C# 里格式化,也可以在数据库里  SQL
      

  4.   

    using System.Globalization;DateTimeFormatInfo dtfi = DateTimeFormatInfo.InvariantInfo;
    string _time = "Oct 27 13:00:01 2009";
    DateTime dt = DateTime.ParseExact(_time, "MMM dd HH:mm:ss yyyy", dtfi);
    Console.WriteLine(dt.ToString());
      

  5.   

    DateTime date1 = new DateTime(2008, 4, 10);
    Console.WriteLine(date1.ToString("D", 
                      CultureInfo.CreateSpecificCulture("en-US")));
    // Displays Thursday, April 10, 2008                        
    Console.WriteLine(date1.ToString("D", 
                      CultureInfo.CreateSpecificCulture("pt-BR")));
    // Displays quinta-feira, 10 de abril de 2008                        
    Console.WriteLine(date1.ToString("D", 
                      CultureInfo.CreateSpecificCulture("es-MX")));
    // Displays jueves, 10 de abril de 2008                        
      

  6.   

    SnippetCompiler真方便,哈哈哈哈哈~using System;
    using System.Collections.Generic;
    using System.Globalization; public class MyClass
    {
    public static void RunSnippet()
    {
    DateTimeFormatInfo dtfi = DateTimeFormatInfo.InvariantInfo;
    string _time = "Oct 27 13:00:01 2009";
    DateTime dt = DateTime.ParseExact(_time, "MMM dd HH:mm:ss yyyy", dtfi);
    WL(dt.ToString());
    RL();
    }

    #region Helper methods

    public static void Main()
    {
    try
    {
    RunSnippet();
    }
    catch (Exception e)
    {
    string error = string.Format("---\nThe following error occurred while executing the snippet:\n{0}\n---", e.ToString());
    Console.WriteLine(error);
    }
    finally
    {
    Console.Write("Press any key to continue...");
    Console.ReadKey();
    }
    } private static void WL(object text, params object[] args)
    {
    Console.WriteLine(text.ToString(), args);
    }

    private static void RL()
    {
    Console.ReadLine();
    }

    private static void Break() 
    {
    System.Diagnostics.Debugger.Break();
    } #endregion
    }
      

  7.   


     DateTime date1 = new DateTime(2008, 4, 10, 6, 30, 0);
                Console.WriteLine(date1.ToString("MMM dd HH:mm:ss yyyy",
                                  CultureInfo.CreateSpecificCulture("en-US")));
      

  8.   

    CultureInfo myCIintl = new CultureInfo( "es-ES", false );
                string xx = DateTime.Now.ToString("dd MMM yyyy", myCIintl);
      

  9.   

    SnippetCompiler真方便,的确不错啊。呵呵!!!