DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2007
    Posts
    20

    Get Unix timestamp from x days ago

    Can anybody please tell me how to get the Unix timestamp from a certain amount of days ago?

    To get the current Unix timestamp I can do this.

    Code:
    (Now - DateSerial(1970, 1, 1)) * 86400
    But I need the Unix timestamp from let's say 75 days ago. It doesn't have to be precisely on the second, but I need to delete data that is a certain amount of days old by comparing Unix timestamps.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    How about:

    (DateAdd("d", -75, Now) - DateSerial(1970, 1, 1)) * 86400
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Apr 2007
    Posts
    20
    That works fine. Thank you.

Similar Threads

  1. How to translate Unix timestamp to readable Date
    By nicolas in forum VB Classic
    Replies: 1
    Last Post: 12-06-2002, 07:17 PM
  2. Converting UNIX TimeStamp To DateTime
    By Ben Merrills in forum .NET
    Replies: 1
    Last Post: 07-19-2002, 04:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links