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;
                    }
                }
            }

  • 相关阅读:
    前端之script标签注意事项
    前端之常用网址的整理
    前端之清除浮动
    三元表达式
    迭代器 生成器
    文件处理流程
    python中常见的内置函数
    匿名函数lambda
    模拟问路场景理解递归
    create auto increment row with select in postgreSQL
  • 原文地址:https://www.cnblogs.com/wuchao/p/2693894.html
Copyright © 2011-2022 走看看