707510f04bc52310d185e50644fe1ca8ef5f25b9.svn-base 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Core.LZMes.Client.UIM
  6. {
  7. class UIMTools
  8. {
  9. /// <summary>
  10. /// 将UltraDateTimeEditor时间格式字符串转换为yyyyMMdd格式字符串
  11. /// </summary>
  12. /// <param name="timestrObj"></param>
  13. /// <returns></returns>
  14. public static string FormatTimeStr(Object timestrObj)
  15. {
  16. string retStr = "";
  17. string timestr = "";
  18. if (null != timestrObj && !"".Equals(timestr = timestrObj.ToString()))
  19. {
  20. string tmpstr = timestr.Split(' ')[0];
  21. string[] timestrArray = tmpstr.Split('-');
  22. for (int i = timestrArray[0].Length; i < 4; i++)
  23. {
  24. retStr += "0";
  25. }
  26. retStr += timestrArray[0];
  27. for (int i = timestrArray[1].Length; i < 2; i++)
  28. {
  29. retStr += "0";
  30. }
  31. retStr += timestrArray[1];
  32. for (int i = timestrArray[2].Length; i < 2; i++)
  33. {
  34. retStr += "0";
  35. }
  36. retStr += timestrArray[2];
  37. }
  38. return retStr;
  39. }
  40. }
  41. }