Search
 
SCRIPT & CODE EXAMPLE
 

SQL

postgres format date in select

select pg_catalog.concat(current_date,' 00:00:00')::timestamp /*Formata hora por exemplo no where*/

and plan_signed_at = TO_CHAR(created_at, 'YYYY-mm-dd')::timestamp /*Formata hora por exemplo no where um é date, o outro datetime*/

select  NOW() - INTERVAL '180' MINUTE /*pega a data e hora com 3 horas menos*/

select to_char(NOW(), 'yyyy/MM/dd HH24:MI:SS') AS date_no_tz, NOW() as date_tz /*data formatada com e sem timezone*/
Comment

Date format in PostgreSQL

SELECT Orderdetails,OrderDate as ExistingDateformat,
to_char(OrderDate,'DD-MM-YYYY') As DDMMYYYY,
to_char(OrderDate,'DD-MM-YY') As DDMMYY,
to_char(OrderDate,'DD.MM.YY') As "DD.MM.YY",
to_char(OrderDate,'MM/DD/YYYY') As "MM/DD/YYYY",
to_char(OrderDate,'DAY MM/DD/YYYY') As "MM/DD/YYYY",
to_char(OrderDate,'DDD MM/DD/YYYY') As "DDD MM/DD/YYYY"
FROM SalesOrders
Comment

PREVIOUS NEXT
Code Example
Sql :: phpmyadmin change password 
Sql :: get all columns from table sql 
Sql :: Check user permissions on postgres database 
Sql :: recently updated stored procedure in sql server 
Sql :: sql update table set text to lowercase 
Sql :: alter schema sql server 
Sql :: clear screen command on mysql 
Sql :: mysql export and import 
Sql :: mysql remove html tag 
Sql :: alter table add multiple foreign key sql 
Sql :: sql pagination oracle 
Sql :: how to calculate number of days between two dates excluding weekends in oracle 
Sql :: mysql query dates between two dates 
Sql :: install mysql 5.7 
Sql :: show all event schedular on mysql 
Sql :: find the median in sql 
Sql :: SQL Server lock table example 
Sql :: oracle list grants on procedure 
Sql :: how to put value in variable mysql 
Sql :: select 2 rows in sql 
Sql :: how to delete the rows with null values in mysql 
Sql :: how to find third highest salary in sql 
Sql :: ERROR 1046 (3D000): No database selected 
Sql :: sql row number in result set 
Sql :: round in sql server 
Sql :: for json path sql server 
Sql :: SQL Server Altering Column to be Unique 
Sql :: rename a column in sql server 
Sql :: mysql delete data in table 
Sql :: 11:04:35 PM [mysql] Error: MySQL shutdown unexpectedly. 11:04:35 PM [mysql] This may be due to a blocked port, missing dependencies, 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =