Search
 
SCRIPT & CODE EXAMPLE
 

SQL

SQL Server format datetime

SELECT FORMAT(CURRENT_TIMESTAMP, 'yyyy-MM-dd hh:mm:ss tt')
Comment

date format in sql

SELECT CONVERT(VARCHAR, GETDATE(),101) AS DATE
SELECT CONVERT(VARCHAR, GETDATE(),102) AS DATE
SELECT CONVERT(VARCHAR, GETDATE(),103) AS DATE
SELECT CONVERT(VARCHAR, GETDATE(),104) AS DATE
SELECT CONVERT(VARCHAR, GETDATE(),105) AS DATE
SELECT CONVERT(VARCHAR, GETDATE(),106) AS DATE

SELECT DATE = FORMAT(GETDATE(), 'dd-MM-yyyy')
Comment

SQL Date Format

SELECT FORMAT(dbo.column, 'M/dd/yyyy')
Comment

sql datetime format

SELECT DATE_FORMAT(DATE, '%m %d %Y') FROM table;

/*Example with now*/
SELECT DATE_FORMAT(NOW(), '%m %d %Y');
Comment

sql format time

-- date format
declare @dat datetime = getdate();
select FORMAT(@dat, N'yyyy-MM-dd hh:mm tt') -- returns 2022-05-09 09:35 PM 
-- similar to c# .ToString("yyyy-MM-dd hh:mm tt")
Comment

sql date format

default date format of my sql - YYYY-MM-DD
Comment

PREVIOUS NEXT
Code Example
Sql :: How to drop procedures in mysql ? 
Sql :: postgres user permissions 
Sql :: sql server to uppercase 
Sql :: get week day from date in sql 
Sql :: add time to date sql 
Sql :: division by zero postgres 
Sql :: SQL query to verify the size of the table 
Sql :: if column value is null then in mysql 
Sql :: postgresql filter on 
Sql :: mysql load sql from file 
Sql :: oracle array 
Sql :: postgresql random phone number 
Sql :: mysql select count 
Sql :: q operator in plsql 
Sql :: mysql if 
Sql :: intellij mysql set timezone 
Sql :: replace text in sql 
Sql :: activate binary log mariadb 
Sql :: mysql create table query 
Sql :: mysql show create table 
Sql :: delete top 10 rows in sql 
Sql :: sql oracle update multiple rows 
Sql :: mysql time 
Sql :: sql alchemy or 
Sql :: orderBy sqlalchemy 
Sql :: sql values to array of objects 
Sql :: find log file postgresql linux 
Sql :: sql stored procedure with table parameter 
Sql :: Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details. 
Sql :: Grant privileges of databse to user 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =