Search
 
SCRIPT & CODE EXAMPLE
 

SQL

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 :: begin transaction in sql 
Sql :: how to use lower case in mysql 
Sql :: mysql change collation one column 
Sql :: mysql add root password 
Sql :: mysql date time string format python 
Sql :: get count of duplicate records 
Sql :: date diff sql 
Sql :: convert date to dd/mm/yyyy sql 
Sql :: 2nd highest salary in mysql 
Sql :: sql not equal multiple columns 
Sql :: mysql change auto_increment start value 
Sql :: sql query duplicate rows 
Sql :: brew install mysql 8 
Sql :: SQL Server - Count number of times a specific character appears in a string 
Sql :: create user sql server 
Sql :: oracle insert or update 
Sql :: postgres cast as decimal 
Sql :: postgresql find duplicates 
Sql :: how to delete user in mysql 
Sql :: create new schema mysql 
Sql :: mysql drop database 
Sql :: recently updated stored procedure in sql server 
Sql :: n highest salary in sql 
Sql :: alter table add multiple foreign key sql 
Sql :: how to insert ip address in mysql using php 
Sql :: install mysql 5.7 
Sql :: postgres : ERROR: division by zero 
Sql :: mysql change default collation 
Sql :: how to extract only year and month from date in sql 
Sql :: sort by sql 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =