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

  • 相关阅读:
    12款JavaScript表单插件
    10个强大的Javascript表单验证插件推荐
    memcached服务器搭建
    15 个非常吸引人的 jQuery 弹窗插件
    37个超级棒的 jQuery菜单插件
    nginx添加ssl证书认证
    27个jQuery网页拖放操作的插件
    memcached集群负载均衡
    python基础2
    ADO SQL数据库
  • 原文地址:https://www.cnblogs.com/wuchao/p/2693894.html
Copyright © 2020-2023  润新知