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

  • 相关阅读:
    SQL 2008 数据库只读 修改
    java List 简单使用
    鼠标右键菜单 删除
    SQL distinct
    日系插画学习笔记(五):日系角色脸部画法-1头部
    日系插画学习笔记(四):基础人体结构
    日系插画学习笔记(三):光影与结构
    日系插画学习笔记(二):结构与透视
    日系插画学习笔记(一):SAI软件基础
    spring mvc 静态资源版本控制
  • 原文地址:https://www.cnblogs.com/wuchao/p/2693894.html
Copyright © 2011-2022 走看看