Solved

Date Stored as number in postgre database

Posted on 2009-03-31
4
621 Views
Last Modified: 2012-06-21
All,
I have a date stored in a postgre database that is stored as a number, but I am not sure about how to convert it back to a date using vb.net. For instance, 1203094800 = 2/15/2008.
Can someone show me how to convert this number back to a regular date using vb.net or a postgresql statement. This method that is used in the payroll software is very annoying, but I do not want to rewrite the whole program.
0
Comment
Question by:jpadkins49
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 250 total points
ID: 24033890
This ironically works...

DateTime _date = new DateTime(1970,1,1).AddSeconds(1203094800);
0
 
LVL 22

Assisted Solution

by:earth man2
earth man2 earned 250 total points
ID: 24034576
select cast( 'epoch' as timestamp ) + 1203094800 * interval '1 second';
      ?column?      
---------------------
 2008-02-15 17:00:00
(1 row)
0
 
LVL 22

Expert Comment

by:earth man2
ID: 24034768
going the other way using extract
SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08');
0
 
LVL 1

Author Closing Comment

by:jpadkins49
ID: 31565058
Thanks for all the help. That solved my problem.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now