To Set the Duration for New icon in SharePoint (the indicator which shows next to new items) access the SharePoint WebApplication object and set the value for DaysToShowNewIndicator.
SPWebApplication WebApp = SPWebApplication.Lookup(new Uri(WebAppURL.Text));
WebApp.DaysToShowNewIndicator = 3;
WebApp.Update();
[…]