Hey kids, what day is it?
-
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day); -
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);Because using time spans is harderest. Soupcon of a brain fart there. It's c#, so
addDays()
does it all for you. But that needs thinkification.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);To introduce subtle bugs around midnight, that require expensive fixing and guarantee a job for life?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
-
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day); -
I've done something similar to the second one of those, i.e.
DateTime now = DateTime.Now;
DateTime midnight = new DateTime(now.Year, now.Month, now.Day);Am I missing an elegant way to do that?
DateTime endDate = DateTime.Today;
Today is Now with the time truncated.
-
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);Erm, I was just logging on to report myself for this. It looks very similar :-)
System::Drawing::Rectangle clientRectangle = System::Drawing::Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
I have no defense, guilty as charged :-(
-
Erm, I was just logging on to report myself for this. It looks very similar :-)
System::Drawing::Rectangle clientRectangle = System::Drawing::Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
I have no defense, guilty as charged :-(
It would be interesting to have a coding horrors forum that only allowed self-reported craziness.
-
Erm, I was just logging on to report myself for this. It looks very similar :-)
System::Drawing::Rectangle clientRectangle = System::Drawing::Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);
I have no defense, guilty as charged :-(
The first step to recover is admitting you have a problem.:thumbsup:
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
DateTime endDate = DateTime.Today;
Today is Now with the time truncated.
-
DateTime endDate = DateTime.Today;
Today is Now with the time truncated.
One could also use
DateTime.Now.Date;
. -
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);LOL It had been some time since I checked this forum and when I saw the title of this post I thought there would be tons of Rebbeca Black references (I'm writing this as of FRIDAY, September 7th)
-
The first step to recover is admitting you have a problem.:thumbsup:
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
How would that work for people who suffer from hypochondria? ;P
-
Why do people do this? To make my brain hurt?
DateTime startDate = new DateTime(
DateTime.Now.AddDays(-1).Year,
DateTime.Now.AddDays(-1).Month,
DateTime.Now.AddDays(-1).Day);DateTime endDate = new DateTime(
DateTime.Now.Year,
DateTime.Now.Month,
DateTime.Now.Day);