zoukankan      html  css  js  c++  java
  • string时间转换为时间格式

    public string formatDataStr(string objstring)
            {
                if (objstring == "" || objstring == null || objstring == ".")
                {
                    return "";
                }
                else
                {
                    string tmpresultstr;
                    objstring = objstring.Replace(",", ".").Replace(",", ".").Replace(" ", "").Replace("/", ".").Replace("-", ".");
                    string[] objstringlist = objstring.Split('.');
                    if (objstringlist.Count() >= 1)
                    {
                        if (objstringlist[0].Trim().Length == 2)
                        {
                            tmpresultstr = "20" + objstringlist[0].Trim();
                        }
                        else
                        {
                            tmpresultstr = objstringlist[0].Trim();
                        }
                        for (int i = 1; i < objstringlist.Count(); i++)
                        {
                            if (objstringlist[i].Trim().Length == 1)
                            {
                                objstringlist[i] = "0" + objstringlist[i].Trim();
                            }
                            tmpresultstr = tmpresultstr + "." + objstringlist[i];
                        }
                        return tmpresultstr;
                    }
                    else
                    {
                        return objstring;
                    }
                }
            }

  • 相关阅读:
    学习数据结构基础
    epoll
    pthread_create
    设置套接字选项
    5中I/O模型
    数据仓库一些整理(列式数据库)
    mysql分区方案的研究
    订单表的分库分表方案设计(大数据)
    从源码角度理清memcache缓存服务
    性能,不是不重要,而是,它没有可维护性重要
  • 原文地址:https://www.cnblogs.com/wuchao/p/2693894.html
Copyright © 2011-2022 走看看