开发者

PostgreSql + Date Format Convert YYYY-MM-DD to Day, Date Month Year

开发者 https://www.devze.com 2023-01-27 06:54 出处:网络
Suppose I am storing this format in my postgre database table. Now I have to compare this date with one of the texbox value contain date in different format.

Suppose I am storing this format in my postgre database table. Now I have to compare this date with one of the texbox value contain date in different format.

Database Date Format :: YYYY-MM-DD For example :: 2010-11-26

Text-Field Date Format :: Day, Month Date, Year :: Fri, Nov 26, 10

Now I have tried to compare this value but no response Plz suggest.

    Select * from table_name where user_id=('11') 
and to_char(effective_date, $$$$$$$$)开发者_开发问答=trim('Fri, Nov 26, 10');

Now Plz suggest which format should I use in place of $$$$$$$$ ???

Thanks !!!


SELECT 
  * 
FROM 
  table_name 
WHERE 
  user_id=('11') 
AND 
  to_char(effective_date, 'Dy, Mon DD, YY') = trim('Fri, Nov 26, 10');


This should do it: to_char(effective_date, 'Dy, Mon DD, YY')

Btw: this is all documented in the manual: http://www.postgresql.org/docs/current/static/functions-formatting.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号