How to programmatically set the date and time of the Publish field of Publishing section in Sitecore -


xmlnode jobpostdate = xmldocumentobject.selectsinglenode("msgdata/hrs_jo_pst_opn_dt) var jpdate = jobpostdate.innertext; datetime dt1 = convert.todatetime(jpdate); var hrs_jo_pst_opn_dt = dt1; newitem.fields[sitecore.fieldids.publishdate].value = hrs_jo_pst_opn_dt.tostring(); 

i using above code date (01/09/2013) , set publish field, getting '1/1/0001' values, shown in below picture, in field.

publishing section publish , unpublish set '1/1/0001'

please advise doing wrong.

try set value of date field:

newitem.publishing.publishdate = dt1; 

use publishing.unpublishdate property set unpublish date


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -