×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Serial Date Conversion in PSQL

Serial Date Conversion in PSQL

Serial Date Conversion in PSQL

(OP)
I work with an application that uses a date format of the number of days passed since 01/01/0001.

Would any one know of the correct function to use to convert into a date through PSQL.  I can do the conversion usind DateSerial after linked to MS SQL or MS Excel, but I was curious to see what the equivalent would be when creating a PSQL view from the Pervasive Control Center.

For Example, our application would store 732342.  If I export into excel, I can subtract 693594 from it to get a value of 38748.  This value represents the number of days since 01/01/1901.  When formatted as a date in Excel it would then show correctly as 01/31/2006.  

RE: Serial Date Conversion in PSQL

What version of PSQL are you using?  There isn't a DateSerial function built into PSQL but if you are using v9 or later, you might be able to create your own function.  

Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
http://www.mirtheil.com

RE: Serial Date Conversion in PSQL

(OP)
PSQL 9.  

I think that I found the function:
TIMESTAMPADD ( SQL_TSI_DAY, "table name"."field.name", CONVERT('0001-01-01', SQL_TIMESTAMP) ) -1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close