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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:55:17+00:00 2026-06-17T03:55:17+00:00

I am wondering how I would loop through a date/time or any type of

  • 0

I am wondering how I would loop through a date/time or any type of variable to go from 00:00 to 24:00 every 30 Mins?

So I need a variable that shows times in 24HR format (01:00, 09:00) and every time I loop through it, to add 30 mins to the time? I then need to use this value in a string.

The time needs to start at 00:00AM and will end with 24:00.

Any ideas how should I go with it?

output should be like this - 00:00 00:30 01:00 ....24:00
  • 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-17T03:55:18+00:00Added an answer on June 17, 2026 at 3:55 am

    Possibly a little over kill, but it does all the auto rolling and allows the use of DateFormat

    DateFormat df = new SimpleDateFormat("HH:mm");
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.HOUR_OF_DAY, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    int startDate = cal.get(Calendar.DATE);
    while (cal.get(Calendar.DATE) == startDate) {
        System.out.println(df.format(cal.getTime()));
        cal.add(Calendar.MINUTE, 30);
    }
    

    You can’t have 24:00 as it’s 00:00…

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

Sidebar

Related Questions

I am wondering how I would loop through a datetime or any type of
I was wondering would I still need to use a basic game loop for
So I am wondering what would cause it so that all events for the
I am using while(matcher.find()) to loop through and retrieve things from a file. I
I would like to loop through a big two dimension list: authors = [[Bob,
I was wondering if its possible, to loop through an array but have each
I was wondering if its possible, to loop through an array but have each
As the title says I am wondering if it is possible to loop through
Just wondering if there's any .net equivalent of the EOPAGE from PHP? For clarity
I am wondering how I can loop through a certain column in a table

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.