Chris Blunt

Rails and Android Software Developer. Founder of Pymouth Software. Tea Drinker.

Main menu

Skip to primary content
Skip to secondary content
  • twitter
  • github
  • about.me

Tag Archives: database

PostgreSQL: Cast a String to Timestamp in PostgreSQL

Posted on 20 August 2008 by Chris

If storing a date/timestamp in a varchar or text field in postgres, the to_timestamp() function will let you access the value as a ‘real’ date. The second parameter tells the function the format of your string:

SELECT to_timestamp('2008-08-01', 'YYYY-MM-DD') AS DATE;
Posted in Uncategorized | Tagged database, postgres, programming, snippet

Photo

Web and mobile apps developer working with Ruby on Rails and Android.

Founder of Plymouth Software.

Enjoys business, tech, travel, and the fine art of drinking tea.

Proudly powered by WordPress