Solved

Update Record with a similar funtion to dateadd

Posted on 2006-07-13
1
551 Views
Last Modified: 2008-02-01
I have a field in my sybase database that holds dates in an interger format. So for example todays date would be 13342 in that field.

I already know how to read that field in a regular date format.

select dateadd(dd, reactivate_date, '1Jan1970') from requests .....

So anything in the reactivate_date column gets returned as a proper date.

I would like to know, how would I take a proper date and convert it back to the number so I can update that particular field using the companies date structure.

Thanks.
0
Comment
Question by:nplib
1 Comment
 
LVL 14

Accepted Solution

by:
Jan_Franek earned 500 total points
Comment Utility
You need to use datediff function - it is in fact inverse function to dateadd:

for example - this will update reactivate_date with today's date in integer format:

update requests
set reactivate_date = datediff( dd, '1Jan1970', getdate() )
where ...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This article will show you how to create an ISO CD-ROM/DVD-ROM image (*.iso), and MD5 checksum signature, for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5). It's a good idea to compare checksums, because many installations fail because of a corr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

728 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

8 Experts available now in Live!

Get 1:1 Help Now