[mono-android] Date time string

Jonathan Pryor jonp at xamarin.com
Thu Jun 14 22:52:09 UTC 2012


On Jun 14, 2012, at 11:04 AM, Nosh wrote:
> Hi I have the following code 
> 	string time = string.Format("{0}:{1}", hour, minute.ToString().PadLeft(2, '0'));
> 	Job.JobEndDateTime = Now.ToString("dd-MM-yyyy ") + time + ":00";
> The Now.ToString("dd-MM-yyyy ") + time + ":00"; occasionally returns "01-01-0001 0:00:00" Any ideas

Your `hour` variable is 0, i.e midnight, your `minute` variable is 0, and your `Now` variable is equivalent to `new DateTime()` (default constructor).

I would suggest checking how you initialize your variables.

 - Jon



More information about the Monodroid mailing list