Get Unix timestamp from x days ago


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Get Unix timestamp from x days ago

  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

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center