Search notes:

SQL Server functions: year(), month() and day()

The SQL Server functions year(), month() and day() return a date's year, month or day as an integer.
select
   year  (getdate()),
   month (getdate()),
   day   (getdate())
Unfortunately, there is no hour(), minute() or second() function (Error message for example: «'hour' is not a recognized built-in function name.»).
These values can be queried with datename:
select
   dateName(hh, getDate())   hour,
   dateName(mi, getDate())   minute,
   dateName(ss, getDate())   second

See also

Extracting year, month, day, hour, minute and second as integer from a VBA date value.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758206516, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQL-Server/T-SQL/functions/_date-related/year-month-day(52): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78