[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

retrieve and convert date using pro*c

Posted on 2004-10-26
2
Medium Priority
?
358 Views
Last Modified: 2008-02-01
Hi,
   I have an Oracle table with a single field called 'rundate'. This field contains a date in the format of date. I need to retrieve this using pro*c code and convert it a number(5) value. Any help would be much appreciated.

Thanks,
          Dust
0
Comment
Question by:dustybryn
[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 Comments
 
LVL 12

Accepted Solution

by:
stefan73 earned 800 total points
ID: 12409666
Hi dustybryn,
You can do that in Oracle directly. Here's an example of converting an Oracle date into C-style time_t:

select (effective_date - to_date('19700101','YYYYMMDD')) * 86400 time_t from subscriber

Whatever the anchor date for your calendar operation is, you can use the same approach. Example: Number of days since 01/01/2000

select trunc(effective_date - to_date('20000101','YYYYMMDD')) millenium_days from subscriber


Cheers!

Stefan
0
 

Author Comment

by:dustybryn
ID: 12410780
Thanks for this Stefan, much appreciated
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
Suggested Courses

650 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