[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

retrieve and convert date using pro*c

Posted on 2004-10-26
2
Medium Priority
?
360 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
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

SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

591 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