sábado, 14 de julio de 2007

Obtener el numero de dias que lleva transcurrido el año en PostgreSQL (Fecha jualiana)

Con la siguiente query, obtenemos el numero de dias transcurridos del año en curso. La solución emplea aritmetica de fechas y fue probada en PostgreSQL 8.2 sobre Ubuntu Linux.

SELECT date_trunc('days', now() - (select cast(date_trunc('year', current_date) as date) as curr_year)::date) + interval '1 day' as dias_transcurridos;


Otra forma simplificada de esto seria mediante la funcion to_char() de postgresql y quedaria de la siguiente forma:

SELECT to_char(now(), 'ddd');

Saludos ;)

4 comentarios:

Anónimo dijo...

[url=http://www.23planet.com]casinos online[/url], also known as settled casinos or Internet casinos, are online versions of household ("hunk and mortar") casinos. Online casinos assistance gamblers to preferred up and wager on casino games totally the Internet.
Online casinos superficially lay down the law odds and payback percentages that are comparable to land-based casinos. Some online casinos exact forth higher payback percentages as a countermeasure looking in regard to glumness plan games, and some producer special-interest assembly payout magnitude audits on their websites. Assuming that the online casino is using an politely programmed indefinitely epitomize up generator, catalogue games like blackjack clothed an established borderline edge. The payout beget a allowance after these games are established at within reach of the rules of the game.
Uncountable online casinos sublease or discern their software from companies like Microgaming, Realtime Gaming, Playtech, Worldwide Execute the requisite Technology and CryptoLogic Inc.

Anónimo dijo...

Hmm is anyone else encountering problems with the images on
this blog loading? I'm trying to find out if its a problem on my end or if it's the
blog. Any suggestions would be greatly appreciated.


Here is my blog ... best ways to make money online

Anónimo dijo...

helpful information These professionals can provide estimates for the big procedures you may have not yet faced. If you lie to insurance companies about your dog and circumstances and they find out then all those premiums will be for nothing and you may only to find out when you need to claim.

Unknown dijo...

Merkur Slots Machines - SEGATIC PLAY - Singapore
Merkur Slot https://septcasino.com/review/merit-casino/ Machines. poormansguidetocasinogambling 5 star 바카라 사이트 rating. The Merkur Casino novcasino game was the first to feature video septcasino.com slots in the entire casino,

Bahia desde el balcon...

Bahia desde el balcon...
Ixtapa Zihuatanejo