Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Date Stored as number in postgre database

Posted on 2009-03-31
4
Medium Priority
?
653 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 1000 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 1000 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

604 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