在vb中怎样把2002-02-12 变为 2000-02

解决方案 »

  1.   

    是说日期格式吗?用Format函数试试
      

  2.   

    一、
      dim datTime as dateTime
      datTime=Cdate("2002-02-12")
      datTime=Cdate(Format(datTime,"YYYY-MM"))
    二、
      dim strTime as string
      strTime="2002-02-12"
      strTime=Mid(strTime,1,7)  '截取前7位
      

  3.   

    Text1 = format(#2002-02-12#, "yyyy-mm")
      

  4.   

    同意
    Text1 = format(#2002-02-12#, "yyyy-mm")
      

  5.   

    dim dt as date
    dt = 2002-02-12 text1.text = Format(dt,"yyyy-mm")
      

  6.   

    Text1 = format(#2002-02-12#, "yyyy-mm")这样应该可以啊!