I am very new to USQL and wondering how to cast a "datetime" to "date" in a select statement. Also, how do i get rid of the millisecond and am/pm? I'd really appreciate any help on this. Thank you all.
Below is the code that works.Notice the parenthesis.
@date =
SELECT (datevalue).ToString("MM-dd-yyyy") AS date
FROM @datetime;
You can use inline C# to do that.
@rowset = SELECT dateTimeColumn.Date AS dateOnly FROM @anotherrowset;
To get rid of values you can use the dateTime.ToString(format), e.g. dateTime.ToString("mm/dd/yy hh:mm).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With