Looking at msdb.dbo.agent_datetime scalar value function. What date / time format is this expressed in, UTC? Same question for msdb.dbo.sysjobs columns : run_date, run_time
SQL Server 2014 – Date Time Format for msdb.dbo.agent_datetime Function
sql serversql server 2014
Related Question
- Sql-server – Why would call to scalar function inside a Table Value Function be slower than outside the TVF
- Using Scalar Hashing Function in Computed Column – Non-Deterministic?
- Sql-server – convert date format for this value ‘19920000’
- Troubleshooting Scalar Function Value Not Being Stored in SQL Server
- SQL Server 2008 – Globalization with Date Time
- SQL Server – Function to Return Date Format from Character Input
- SQL Log Shipping – Date Time Format in Transaction Log File Name
Best Answer
Are you asking about the format or the value?
By "value" I mean if it is in UTC or the local datetime value.
The function doesn't have a stored value, it work with what you pass into it and returns a datetime value based on that. I.e., there's no UTC relevance for this.
The columns, for instance in sysjobhistory, are not in UTC. They are in the local timezone (for your SQL Server instance).
As for the format:
The tables uses a pair of int columns - one for date and one for time. So the int 20191223 means 2019-12-23 (I'm using ISO 8609 format when communicating datetime values).
The function accepts two parameters, both int. One for the date and one for the time, as described above. It returns a datetime value (which has no format - it is just a value).
In case you wonder how I know it returns a datetime and not datetime2(3): You can investigate a value by casting it to sql_variant and then investigate properties of that value using the SQL_VARIANT_PROPERTY function:
Above returns: