Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8100909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:51:39+00:00 2026-06-05T22:51:39+00:00

I am trying to return the value by using unix_timestamp function but it behaves

  • 0

I am trying to return the value by using unix_timestamp function but it behaves strange.

set @currentdate:= UNIX_TIMESTAMP(NOW() + 1000) /* 1339947588 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 2000) /* 1339948188 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 3000) /* 1339948788 */

set @currentdate:= UNIX_TIMESTAMP(NOW() + 4000) /* 0 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 5000) /* 0 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 6000) /* 0 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 7000) /* 0 */

set @currentdate:= UNIX_TIMESTAMP(NOW() + 8000) /* 1339949388 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 9000) /* 1339949988 */
set @currentdate:= UNIX_TIMESTAMP(NOW() + 10000) /* 1339950588 */

Why it returns the value of 0 for the values between 4000-7000 ?

What I see that the answer related by the current time because the interval, that gives the 0, changes by the time passing. What can be the reason ?

Thanks in advance,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T22:51:40+00:00Added an answer on June 5, 2026 at 10:51 pm

    This is not strange at all. You are adding some numbers to the result of NOW() before calling UNIX_TIMSETAMP() on the result. I think you want to call UNIX_TIMESTAMP before adding your values:

    UNIX_TIMESTAMP(NOW()) + 4000
    

    or just

    UNIX_TIMESTAMP() + 4000
    

    Both of these will add 4000 seconds to the current time. Another solution is to use the INTERVAL keyword to add time units to a date:

    NOW() + INTERVAL 4000 SECOND
    

    According to the manual, when NOW() + 4000 is evaluated, NOW() returns a number in this format: YYYYMMDDHHMMSS.uuuuuu, e.g., 20071215235026.000000. If you add 4000 to this you may or may not get something which resembles a real date. As you can see, you will not add seconds or any other defined entity. If you get a correct date UNIX_TIMESTAMP will return a timestamp, otherwise it will return 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to return a value from (transport) to the calling function, but can't
I'm using the code: var x = function() {return true;}; trying to set x
Im trying to return the value that a $ajax call returns, from a function
I'm trying to return the track href value from the spotify api using the
I am trying to access textbox value using the jQuery code; $(#pg_textbox).val(); But it
I am trying to return Xml value from SQL Server 2005 using For Xml.
I'm getting the following error when trying to return the value using the operator*()
I'm trying to return a different value using a simple if/else to check for
I'm trying to get the return value of a utility method I wrote using
I am trying to return a value (ID), matching another field (Type) in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.