Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

How to correct this timestam for the current day?

$
0
0
Hello, I'm creating a timestamp of the actual day (from this day's midnight to the other's), but I'm having some issues...One of the problems is that with the code that I have, I can only get the results from the past day to this day.[code="other"]Code:SELECT "num", dateadd(hour, -(num), DATEDIFF(d, 0, GETDATE())) AS interval_start, dateadd(hour, -(num + 1), DATEDIFF(d, 0, GETDATE())) AS interval_endFROM numbersGO[/code][b]Here it is a PrintScreen, so you guys can understand what I'm saying:[size="1"][/size][/b][img]http://i.imgur.com/ncjwByJ.jpg[/img]---------------------------------------------------------------------------------------------Another problem that I have is, like you might seen, the timestamp is upside down, starting on the left corner...Can I fix this problem easily with the code I have? I aprecciate any kind of help, since I'm new to the world of SQL and I'm still learning, hehe. :)Many thanks! :-D :-D :-D

Viewing all articles
Browse latest Browse all 3145

Trending Articles