本文介绍了如何从c#中的变量中获取日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我想从变量中获取日期,但是当它为我返回值时,没有真正的形式。

  public   static 列表< business> ContactSelectAll()
{
DataTable dtb = DataAccess.ContactSelectAll();
列表< business> result = new 列表< business>();
foreach (DataRow记录 dtb.Rows)
{
Business bus = new Business();
bus.Id = Convert.ToInt32(record [ Id]);
bus.Name = Convert.ToString(record [ Name]);
bus.Family = Convert.ToString(record [ Family]);
bus.Address = Convert.ToString(record [ Address1]);
bus.PhoneNumber = Convert.ToString(record [ PhoneNumber]);

DateTime birth = new DateTime();
bus.BirthDate = Convert.ToString(birth.Date.ToString( d /月/年));

bus.EmailAddress = Convert.ToString(record [ EmailAddress] );
bus.FacebookAddress = Convert.ToString(record [ Facebook]);

result.Add(bus);
}
返回结果;
}
解决方案



Hi friend,
I wan to get date from a variable but when it return value for me, doesn't have a true form.

public static List<business> ContactSelectAll()
       {
           DataTable dtb = DataAccess.ContactSelectAll();
           List<business> result = new List<business>();
           foreach (DataRow record in dtb.Rows)
           {
               Business bus = new Business();
               bus.Id = Convert.ToInt32(record["Id"]);
               bus.Name = Convert.ToString(record["Name"]);
               bus.Family = Convert.ToString(record["Family"]);
               bus.Address = Convert.ToString(record["Address1"]);
               bus.PhoneNumber = Convert.ToString(record["PhoneNumber"]);

               DateTime birth = new DateTime();
               bus.BirthDate = Convert.ToString(birth.Date.ToString("d/mm/yyyy"));

               bus.EmailAddress = Convert.ToString(record["EmailAddress"]);
               bus.FacebookAddress = Convert.ToString(record["Facebook"]);

               result.Add(bus);
           }
           return result;
       }
解决方案




这篇关于如何从c#中的变量中获取日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 05:45