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 8548091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:24:53+00:00 2026-06-11T13:24:53+00:00

I am writing some data analysis software, I want to upscale timebase of my

  • 0

I am writing some data analysis software, I want to upscale timebase of my Raw Data. My Raw Data has a time step of ~2minutes. I want to scale the data into several database tables with a timestep of 5minutes, hourly, daily and monthly. I plan to run each of these from the raw data to keep my accuracy up.

The problem I am currently having is taking an initial value and finding the closest ’round’ time point I want to it, to be my start point. For example, I will start with the point 13/03/12 00:01:36 as my start point, I want the code to find 13/03/12 00:00:00 as the closest time point so it will start calculating from there. For each time point I want to take half of the time step on each side. So 12/03/12 23:57:30 to 13/03/12 00:02:29 will become 13/03/12 00:00:00.

The Data is taken from Access using a SQL query and the Date and Value are stored in two side by side Arrays. Below is my code so far. It will round the values up to the NEXT 5 minutes, rather than up or down to the NEAREST 5 mimutes.

Private Sub RateStateScale(ByVal Parameter As Integer, ByVal Timebase As String)

    Dim NewDate(0)
    Dim NewData(0)
    Dim RecordCounter
    Dim MinValue As Date = ScaleDate(0)
    Dim startpoint As String

    For RecordCounter = 0 To ScaleDate.GetLength(0)
        If MinValue > ScaleDate(RecordCounter) Then
            MinValue = ScaleDate(RecordCounter)
        End If
    Next

    Do Until MinValue.Minute Mod 5 = 0
        MinValue = MinValue.AddMinutes(1)
    Loop



End Sub

Thanks for your help

  • 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-11T13:24:54+00:00Added an answer on June 11, 2026 at 1:24 pm

    Let’s try some VB, for a “round to nearest 5 minutes” function:

    ' just some date, should be a parameter to your function
    Dim mydatetime = new DateTime(2012,3,12,23,57,30)
    
    ' split into date + time parts
    Dim datepart = mydatetime.Date
    Dim timepart = mydatetime.TimeOfDay
    
    ' round time to the nearest 5 minutes
    timepart = TimeSpan.FromMinutes(Math.Floor((timepart.TotalMinutes+2.5)/5.0) * 5.0)
    
    ' combine the parts
    Dim newtime = datepart.Add(timepart)
    ' a function would return this value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing some data analysis software and decided to use such approach: epn: model/data.py
I'm writing a program to do some statistical analysis on data imported from a
I am writing some data access code and I want to check for potentially
I want to create a transaction, writing some data in a sub-transaction, reading the
I am using FileOutputStream for writing some data to a file. Every time I
I am writing some XML data to the stringwriter. I want to pass the
I'm writing some data acquisition software and need a gui plotting library that is
Hello I am writing some data structures in C, and I've realized that their
I'm writing some console applications to move some data between SQLite databases. The classes
I am writing some code that can migrate some device persisted data to a

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.