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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:38:03+00:00 2026-05-28T03:38:03+00:00

I am working with a case where the client has a 30 hour day.

  • 0

I am working with a case where the client has a 30 hour day.

The day starts at 6 am and then goes around to 6 am the next day, but when they come to 1 am the next day, they take it as 25:00 hours. 2 am will be 26:00 hours and so forth…

Now, i want to know, is there a way to handle this in c#'s DateTime class or do i need to do it the long way and split it all up?

UPDATE:

It’s a Media Agency in Australia. Just to explain again, the day starts at 06:00 am (12 Jan 2012), when it comes to midnight it will be 24:00. Now when it is 01:00 am (13 Jan 2012) the next day, the client takes it as 25:00 hours (12 Jan 2012).

They still have 24 hours in a day. The only difference is that their day starts at 6 am and not 00 hours like us.

UPDATE:

XML representation of a typical program i need to work with.
Note: Removed CHANNEL_CODE and CHANNEL_NAME.

 <PROGRAMME>
  <PROGRAMME_ID>1</PROGRAMME_ID>
  <PROGRAMME_NAME>Mass For You At Home</PROGRAMME_NAME>
  <CHANNEL_CODE>SomeCode</CHANNEL_CODE>
  <CHANNEL_NAME>SomeChannel</CHANNEL_NAME>
  <TX_DATE>20120101</TX_DATE>
  <START_TIME>06:00</START_TIME>
  <DURATION>1800</DURATION>
  <AGENCY_AVAIL>C</AGENCY_AVAIL>
  <SALES_AVAIL>90</SALES_AVAIL>
  <SSB>N</SSB>
 </PROGRAMME>
</PROGRAMME>


<PROGRAMME>
  <PROGRAMME_ID>2</PROGRAMME_ID>
  <PROGRAMME_NAME>Home Shopping</PROGRAMME_NAME>
  <CHANNEL_CODE>SomeCode</CHANNEL_CODE>
  <CHANNEL_NAME>SomeChannel</CHANNEL_NAME>
  <TX_DATE>20120101</TX_DATE>
  <START_TIME>26:00</START_TIME>
  <DURATION>1800</DURATION>
  <AGENCY_AVAIL>C</AGENCY_AVAIL>
  <SALES_AVAIL>0</SALES_AVAIL>
  <SSB>N</SSB>
 </PROGRAMME>

So, is there maybe a way to adjust the DateTime class to start at 06:00 and end at 30: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-05-28T03:38:04+00:00Added an answer on May 28, 2026 at 3:38 am

    This sounds a bit like the situation where you have a business that covers multiple timezones – it’s possible, then, to have a continuous day that is longer than 24 hours.

    However, this doesn’t mean that you have to adjust the length of a day – a day is an international convention, and, unless Jon Skeet actually decides to use the giant gravity gun he has undoubedly built (in a day 😉 and uses it to change the rotational speed of the earth, extending the alternating period of light and darkness we refer to as a day, your best bet is to probably use the concept of a shift or timeslot;

    A shift (in your case, a timeslot!) has a work day, a length, and a timezone. You can then:

    • Sum all of the hours an advert was shown for a workday (sum[length] where date = workday)
    • Sum all of the hours an advert was shown for a timezone (sum[length] where timezone = x group by workday
    • Sum all of the hours an advert was on for a particular astronomical date (work out the number of hours between the workday.starttime and midnight versus the length)

    It’s best not to refer to these as days as it confuses straightforward terminology.

    In your instance, you aren’t even bothered about the timezone. I think all you really need is the date/time the advert timeslot is due to start, and the number of hours it is due to be shown for.

    EDIT: In the case of your XML, you can still use the above concept. You can either:

    1) Clean it up when you get the XML and store it as a ‘proper’ datetime – so work out what the UTC starttime is and use the duration

    2) Create a class that just converts this to normal datetime representation with the length. The benefit of this approach is that you can also go the other way, back to the source convention.

    Realistically, I think that’s really all you need.

    For example, in the xml above, you could create a class; something like this should do the trick:

    public class AdvertDate{
    
        public DateTime TransmissionDate { get; set;} //Store as 06:00 on the TX_Date
    
        public int AdvertStartTime { get; set; } //Store as 0 - 30
    
        public int Duration { get; set; } //Store as 18 - assuming whole numbers so change if needed        
        public DateTime RealDate {
            get{
                return TransmissionDate.AddHours(AdvertStartTime);
            }
        }
    
    
        public AdvertDate(){
    
        }
    
        public AdvertDate(DateTime transmissionDate, int advertStartTime, int duration){
            TransmissionDate = transmissionDate;
            AdvertStartTime = advertStartTime;
            Duration = duration;
        }
    
    
        public AdvertDate ConvertRealDateTimeToAdvertDate(DateTime realDateTime, int advertDuration){
    
            if(realDateTime.Hour < 6)
            {
                DateTime  advertDateTime = realDateTime.AddDays(-1).Date.AddHours(6);
    
                return new AdvertDate(advertDateTime, 24+realDateTime.Hour, advertDuration);
            }
            else{
                return new AdvertDate(realDateTime.Date.AddHours(6), realDateTime.Hour, advertDuration);
            }
    
        }
    
    
        public void LoadFromXml(){
            //Xml Loading here (or in a dedicated class or wherever)
        }
    
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a website for a client and they have an interesting
I am working on a binary file transfer program in which the client has
I am having issues with overflow: hidden not working in my case. I have
When working with some open source projects (in my case Joomla and Moodle), I've
Possible Duplicate: Business Case for Resharper I've just recently graduated and I'm working for
I'm trying to get a case-insensitive search with two strings in JavaScript working. Normally
When is it safe to use implicit casting? Use Case : I'm working with
Working on a project that parses a log of events, and then updates a
I am working with an application where we store our client data in separate
I'm working on a multiplayer game which has a lobby-like area where players select

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.