本文介绍了如何解决只有赋值,调用,递增,递减和新对象表达式才能用作语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEllo团队,

当我正在读取它给我这样的价值

而(oreader.read())

{

customClearance.ContainerDate = {13-03-2014 15:42:59}

}



哪个是错误的。

HEllo Team,
when i am reading the value it getting me like this
while(oreader.read())
{
customClearance.ContainerDate ={13-03-2014 15:42:59}
}

Which is wrong.

I have the DateTime Format as follows:
public const string CONST_STR_DB_DATEFORMAT = "yyyy-MM-dd HH:mm:ss";







我正在尝试这个,但它给了我错误。

//customClearance.ContainerDate.HasValue? '+ customClearance.ContainerDate.Value.ToString(GlobalConstants.CONST_STR_DB_DATEFORMAT)+':Null;



ContainerDate的数据类型是Datatime



它给我的错误如下:

错误3只有赋值,调用,递增,递减和新对象表达式才能用作语句



请指导我在哪里出错。如何以日期时间格式获取日期



谢谢

Harshal




I am trying this but it gives me error.
//customClearance.ContainerDate.HasValue ? "'" + customClearance.ContainerDate.Value.ToString(GlobalConstants.CONST_STR_DB_DATEFORMAT) + "'" : "Null";

The datatype for ContainerDate is Datatime

it gives me error as follow:
Error3Only assignment, call, increment, decrement, and new object expressions can be used as a statement

Please Guide ME where i am getting wrong.How to get the date in DateTime Format

Thanks
Harshal

推荐答案

while(oreader.read())
{
customClearance.ContainerDate = new DateTime(2014, 03, 13, 15, 42, 59);
}


string formattedDateTime = customClearance.ContainerDate.ToString(CONST_STR_DB_DATEFORMAT)





有关DateTime格式的更多信息,请在此处查看:

[]


这篇关于如何解决只有赋值,调用,递增,递减和新对象表达式才能用作语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 03:54