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 :: modify column name in sql 
Sql :: kill a pid redshift 
Sql :: sql pad left 0 
Sql :: mariadb mysql root access denied 
Sql :: split string from comma in sql 
Sql :: get first monday of month sql 
Sql :: oracle running queries 
Sql :: sql server information_schema temp tables 
Sql :: connect mysql command line 
Sql :: 1396(hy00) mysql error 
Sql :: view databases in mysql 
Sql :: if null mysql 
Sql :: oracle number to percentage 
Sql :: oracle sql drop column if exists 
Sql :: how to install sql in anaconda 
Sql :: mysql if null 
Sql :: sql running total 
Sql :: adding generated time in row mysql workbench 
Sql :: sql if empty then 
Sql :: sqlite unique 
Sql :: mysql server not starting in xampp in mac 
Sql :: postgress connection refused 
Sql :: sql round 2 decimal 
Sql :: mysql delete rows 
Sql :: how to select an index in oracle sql 
Sql :: postgresql import data from csv 
Sql :: c# update sql statement 
Sql :: create table as select * from table mssql 
Sql :: subquery in sql 
Sql :: sql display max value 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =