Quantcast
Channel: THWACK: Discussion List - All Communities
Viewing all articles
Browse latest Browse all 16365

Is there a SQL Studio Date Time Format function that keeps leading zeroes?

$
0
0

I'm extracting dateTime columns using SQL studio and I only want the date portion in a specific format. For example, I would like this format YYYY-MM-DD and I would like to retain the leading zeros.  According to the SQL Studio SDK documentation, I can concatenate the date parts by using functions Date(), Month(), and Date(). See example below.

 

ToString(Year(N.Node.AssetInventory.ServerInformation.WarrantyDate))

+ '-' + ToString(Month(N.Node.AssetInventory.ServerInformation.WarrantyDate))

+ '-' + ToString(Day(N.Node.AssetInventory.ServerInformation.WarrantyDate))

As warranty_expiration

 

This will produce a value like this -> 2015-7-1

 

Notice the day and month will NOT include the leading zeroes though and that creates a problem for me in what I want to do with the data. I would think there would be a date function like DateFormat(Date, '%YYYY-%MM-%DD) or something like that.  Does anyone know if a function exists that will do this for me using SQL for SolarWinds? Thank you.

Todd


Viewing all articles
Browse latest Browse all 16365

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>