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

  • Home
  • SEARCH
  • 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 7013317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:22:16+00:00 2026-05-27T22:22:16+00:00

Based on current date and time, can i generate 6 digit number? One person

  • 0

Based on current date and time, can i generate 6 digit number? One person said me to use timestamp. Please guide me how to generate 6 digit number based on current time stamp. I need to generate this in such way later I can check the number was generate before 5 second or not. I need to know what logic should I use to reverse logic to find out when the number was generated. Please help with sample code.

Which crypto technique i can use to generate digit if i input current date like DateTime.Now.ToString("yyyyMMddHHmmssffff") ?.

  • 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-05-27T22:22:17+00:00Added an answer on May 27, 2026 at 10:22 pm

    You could do this:

    public static int GetTimestamp()
    {
        // 10m ticks in a second, so 50m in 5 seconds
        const int ticksIn5Seconds = 50000000;
        return (int)((DateTime.Now.Ticks / ticksIn5Seconds) % 1000000);
    }
    

    This gets a number with one to six digits, which changes every five seconds.

    Edit:

    If course, this is not cryptographically secure: if you observe one number then you know what later ones are going to be (because they just increase by 1 each time). If unpredictability is a requirement, you need a different approach.

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

Sidebar

Related Questions

Say I use glRotate to translate the current view based on some arbitrary user
When code processes dates based on the current date, testing should cover edge cases
I want to calculate an oscillating offset value based on the current time in
I have the below program to obtain current date and time. int main(void) {
I want to find a method to include some files based on the current
Our current product is based on Eclipse RCP. We are starting to have problems
For our current J2EE project based on JBoss, we need to interface with a
At my current job we have a CMS system that is .NET/SQL Server based.
I'd like to replace an app's current (badly busted and crufty) cURL-based (cURL command-line
Based on all my reading there should be one GC thread to invoke all

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.