DateTime objects in many programming languages describe an instant in time, expressed as a date and time of day.

learn more… | top users | synonyms

2
votes
2answers
46 views

Date Comparison Script

The University Library where I work is in the process of redesigned our home page. One of the features we wish to include is a widget to display the current hours. Unfortunately for a variety of ...
2
votes
2answers
49 views

Generate the Norwegian equivalent to social security numbers - follow-up

First of, here is my previous post. That should explain a fair bit. The reason I'm posting one more time, is I have changed a lot. Using more classes, let them do all the work, and the overall ...
2
votes
0answers
39 views

Inefficient Stopwatch - revised

This is my revised code of Stopwatch: ...
4
votes
1answer
102 views

Inefficient Stopwatch

I have just finished a simple GUI stopwatch, but some of its code looks like it needs replacing. This is the code: Clock class (extends Thread): ...
2
votes
1answer
34 views

Layout of two different styles of event labels with CSS

I have two types of event labels. The HTML markup is: ...
6
votes
2answers
180 views

Displaying content based on the current time

I'm new to PHP and just wrote a bunch of if statements to display content based on the current time. Is there a better way of writing the following block of code ...
3
votes
3answers
172 views

Optimize parsing more and more

I have the below C# code for parsing. Do you think this is most optimize or I should use generic method or optimization required in these functions themselves? ...
10
votes
1answer
104 views

Managing Google Calendar from Spreadsheet

Overview: I have a need to manage a Google Calendar from a spreadsheet, so I developed a Calendar Manager program with Google Apps Script. I found some inspiration over on Stack Overflow, but my ...
7
votes
3answers
229 views

Have I coded this small object grouping script Pythonically?

I have a small script that takes a list of objects from an SQL table and groups them if the date-time on the object has less than 60 second difference with the last object. It does this by ...
6
votes
1answer
62 views

Add number of hours to 24 hour clock

This function adds a number of hours to a 24 hour clock: ...
3
votes
1answer
43 views

Can this date-validation function can be simplified further or is it the correct approach?

I am doing a date validation. I have no. of pages, which have the date field. User can input the date like "220875" or "22AUG75" - I need to test both and check the length as well. ...
8
votes
5answers
246 views

Convert total minutes into “Hours:minute:seconds” for marathon data

The point of the script below is to read in the 10th column which is the total number of minutes a runner took to finish the marathon and convert it into form of "hours:minutes:seconds". Is there a ...
5
votes
2answers
59 views

Better way of calculating a time in a time zone from multiple dates in SQL?

I'm trying to calculate what time a certain time in a time zone is today, so I can schedule something to happen at that time in that time zone. I've got a table with what I have termed the Nominal ...
2
votes
1answer
53 views

Generate the Norwegian equivalent to social security numbers

This is just a little hobby project I've been working on. I've been using it to learn/improve my knowledge of C++. The program generate Norwegian personal-numbers (11 digits) for males born a given ...
4
votes
2answers
50 views

Dynamic array of Years

I wanted to make a dynamic select statement from this year to 10 years. This gets the job done, but I feel like it's a little much. ...
4
votes
1answer
75 views

How could this “complex method” for codeclimate be refactored?

I'm trying to figure out how to refactor some code based on what codeclimate is telling me. So far it seems that any method that is longer than 5 lines or has an ...
10
votes
3answers
334 views

Optimize a Date and Timespan function

I have a working function that may be optimizable. Currently processing 4 objects gives me 0.0459822 for the elapsed time in seconds - used for testing purposes. ...
1
vote
1answer
51 views

Better way of comparing integers

I wrote this class which is comparing some values, how can I improve its performance and maybe make it prettier? You can see at the bottom what type of data it requires, also the array size can reach ...
2
votes
0answers
14 views

Parsing time ranges with PyParsing

The following code is intended to parse a string of the following format and return whether the current time falls in that window: ...
5
votes
3answers
105 views

Difference in days between two dates

I've been trying to write a really basic function to determine the difference (in days) between two dates. I am very new to C++ so as you can imagine I am very happy with my work. This function is ...
8
votes
2answers
579 views

Calculating how many Pomodori fit into a period of time

I've written some code to calculate how many Pomodori can fit into a period of time, including long and short breaks. I'm looking for alternative solutions because what I have at the moment doesn't ...
3
votes
1answer
63 views

Displaying TimeSpan as largest interval (with units) - Part II

[This is a follow-up question to: Displaying TimeSpan as largest interval (with units). The code listed here has been refactored since the original question was posed. Please note that the scope of ...
5
votes
3answers
289 views

Displaying TimeSpan as largest interval (with units)

The following method is used in a call center application to display an approximation of remaining time. The call center telephone operator would inform the caller that they could perform their ...
7
votes
3answers
233 views

Is there a simpler way to format this timespan?

I'm looking to achieve a time format that looks like this: 2d 4h remaining; or 1h 36m remaining; or 35s remaining, etc. So that it only displays the two largest values of time (this is how Clash of ...
3
votes
3answers
431 views

Beautifying Dates

There has got to be a better way to do this. I have a method which returns either your standard "01/01/2014" Date or "January 1st, 2014" Date of the assembly file write time. Any suggestions on ...
1
vote
1answer
52 views

Is my code clean enough and standard when processing Ruby on Rails requests using User's time zone?

I have an application in Ruby on Rails (3.2) and I want all the requests to take into account the currently logged in user's time zone. Also, I want to have a helper that will let me display date ...
12
votes
3answers
217 views

Calculate future date based on business days

I've written a program for calculating the future date after certain number of business days. ...
5
votes
3answers
103 views

Speed up query to rank team sales by aggregating data from two databases

On my machine it runs in about 60 seconds and about 2-3 minutes live. The criteria needed are: Current month only (from first of month until current day) I need the rank of the currently logged in ...
3
votes
2answers
110 views

Validating C++ Time class objects

I created a Time class. Now I want to modify the code to perform input validation. Hour should be between 0-24, minutes and seconds between 0-59. If class need ...
6
votes
1answer
121 views

Simple stop watch

I'd like my code to be solid and good. That's why I want someone a little more experienced to give me some feedback so I can improve. Here is the code for a simple stop watch that I created. I feel ...
5
votes
1answer
461 views

Can I populate this table faster?

I have the following SQL query which takes ~3 seconds to run, maybe ~4. This populates a consultants table with their expected payments for the month. Unfortunately, the page only loads when this ...
5
votes
1answer
63 views

Seven days a week

I use the jQuery Calendar with an underscore template and I wanted to put <li> tags around each week. This does the trick, but it's awful. ...
3
votes
1answer
90 views

Algorithm to identify a shift and its type based on on and off times

Following code is supposed to identify a shift and then it should identify whether the shift is a night or a day shift. The method will take 'in time' and 'out time' as two parameters. These are the ...
6
votes
2answers
301 views

Output day of the week from given date

I am posting this code up for review and debugging. This source code is for Java, and is meant to give you the exact day of the week from an entered date. Review This program seems to have 2 ...
4
votes
1answer
75 views

Selecting one MySQL date with month reduced by one

I was thinking in a way to improve the following query if possible: ...
6
votes
1answer
104 views

Count and group rows for six months prior

I've written the following query for SQL server: ...
6
votes
1answer
228 views

Please assess my jQuery stopwatch

Here is the link to the jsFiddle and below is the code: JS: ...
6
votes
4answers
208 views

Better way to repeatedly use istringstream in “counting minutes” challenge

I was doing this easy challenge "Counting Minutes I" from Coderbyte.com where you just calculate the number of minutes between two given times. The second time is always after the first, although it ...
6
votes
3answers
223 views

Time Machine service

Recently I had someone describe a "Time Machine" service to me; that is, a service that could be used to change how a chunk of code perceives time. Normally through calls to DateTime.Now and other ...
3
votes
1answer
62 views

Matching items in different arrays and performing operations on them

I have a data structure that uses a Dictionary<ID,TimeSeries> to hold time series for different products. TimeSeries is ...
7
votes
3answers
387 views

Alarm clock with “ringing” functionality

I have a question regarding a program that is to run an alarm clock and display the time (HH:MM AM/PM) and also trigger the alarm and display "ringing" at 12:00 AM. I am a beginner in Java and I am a ...
5
votes
1answer
577 views

Alternative to setInterval and setTimeout

Alternative to setInterval and setTimeout JavaScript's setTimeout and ...
3
votes
2answers
57 views

Adding time offsets to create future dates

How can I shorten this (working) code to create future dates in ruby for use as params in URLs? I'm doing: ...
5
votes
3answers
193 views

Creating date strings and setting dates

I've created a Java class, Date, in which I basically create date strings and set dates. Is there anything I can do besides adding comments to improve/shorten my ...
5
votes
1answer
115 views

Date ranges from a given start date

I'm trying to get a certain number of date ranges given a start date. Here's my code: ...
10
votes
4answers
322 views

Schedule class (exercise for test driven development)

Schedule is a simple class that could be used in program to manage when a task should be repeated (a todo list, for example). Its constructor requires a start date and an optional end date. Then type ...
1
vote
2answers
168 views

Too many nested blocks fixed but not sure if this way is right

I have previeous;y posted my php code with way to many nested blocks I hope I fixed it right. I'd also like some tips on my OOP, as this is new to me. ...
3
votes
1answer
39 views

Extracting performance statistics from FTP session transcript

I've borrowed and written the following code to output the disconnect time. All works well but I'm curious as to how I could tighten/ shorten the code. If anyone feels like having some fun then I'd ...
5
votes
3answers
450 views

Calculate a month later than current month (without rolling over to next month)

I needed a script for working out billing dates over a period of time. The date should be the same day every month however if the billing date starts on a date that doesn't exist in another month, ...
4
votes
3answers
135 views

Get remaining days in date range

I wonder if there are some possible ways to simplify my code. ...