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

learn more… | top users | synonyms

4
votes
1answer
35 views

Shutdown Delay Program

I wrote this program a while back that would allow me to set a delay, say 3 hours, and when the delay had expired, my PC would turn off. The purpose of it was so I didn't have to leave my PC on all ...
8
votes
1answer
42 views

Labor percentage and wages from clock in/out and sales records

I'm developing a PHP function for calculating labor percentage (labor cost/sales) accounting for daily and weekly overtime rules, if applicable, based on the payroll period; the wages for each ...
2
votes
2answers
50 views

Cycling time trials

It would be helpful to know where I could improve the style of it, so it follows the style guide better, and also any ways I could compact it - especially at the end, where I have added items to a ...
3
votes
1answer
39 views

DateTime internal representation to FILETIME

Here is a routine I put together to convert SQL Server's internal DateTime representation (BINARY(8)) to a ...
3
votes
4answers
299 views

Need help to optimise my C# code

I have a section of my code that seems to take a while during processing. Basically rawArray contains ~1.5 million rows and ...
3
votes
1answer
56 views

Structural design of a Date and Time classes [closed]

I have two classes named Date.class and an enum class Time. I have declared these class like ...
2
votes
1answer
59 views

Bitwise operation to get the weekday name

The function days_name receive a val (string) corresponding to weekdays in hexadecimal. ...
0
votes
3answers
73 views

Linq query performs poor according to performance analyzer in VS2012

I've a Linq query that performs poorly: ...
4
votes
3answers
76 views

Validate parameters within a range

Function to use several blocks of if:elif:else: that all take slightly different conditional statements. I'm trying to format integers into a 2 digit string, ...
3
votes
1answer
29 views

Calling PHP file using Ajax

I like to know if there will be any performance issue if an xmlhttp object is created every time. For example, in the below code: ...
7
votes
2answers
133 views

Getting a date range

I'm just trying to be more pythonic in my coding style and was wondering if this is a good way to get a list of seven days leading up to and including endDate: ...
3
votes
4answers
127 views

Code Kata - Berlin Clock

To improve my programming style, I have been writing solutions for popular code katas. I have written a partial solution for the [Berlin Clock kata][1]. Can anyone critique the code and suggest ...
10
votes
4answers
493 views

Integer seconds to formated string mm:ss

I have a String like "Time left (XX)" or "You need stay here for (XX)" and int as second. I use those two variables to format ...
5
votes
2answers
176 views

Calculating months elapsed since a given date

I am using traceview and DDMS to analyse my operation. The following is my traceview as displayed in DDMS: According to the above, the LoaderClass.months() ...
3
votes
2answers
198 views

Checking whether a given timestamp is more than two weeks old

I am trying to see whether a given timestamp is more than two weeks old or not. If it is two weeks old, then print out "Hello" and if it is not more than two weeks old then print out "World". I have ...
6
votes
2answers
80 views

Berlin clock kata in Elixir

I'm starting with Elixir and as exercise I wrote the Berlin Clock kata: The clock is made up of 5 rows. On the very top of the clock is a lamp that blinks to show the seconds. It turns on for one ...
18
votes
6answers
1k views

Average time to first answer

Just trying out my T-SQL foo. Wrote a script to get the average time (in seconds) to first answer for a specified language. ...
3
votes
2answers
54 views

Convert international datestring to ISO-format

The function below takes a datestring in the form d-mmm-yyyy and converts it to ISO date format (yyyy-mm-dd). Delimiters may be hyphen, space or /, and Dutch or ...
2
votes
2answers
53 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
62 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 ...
4
votes
1answer
87 views

Inefficient Stopwatch - revised

This is my revised code of Stopwatch: ...
5
votes
1answer
116 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
65 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
190 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
185 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
137 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
232 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
65 views

Add number of hours to 24 hour clock

This function adds a number of hours to a 24 hour clock: ...
3
votes
1answer
46 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
262 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
62 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
61 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 ...
2
votes
1answer
89 views

Usage of Interlocked.CompareExchange for deciding whether a property has been changed by another thread

I'm developing a Windows Service that receives data from somewhere and saves it to DB one time per 5 minutes. The Service is multithreaded and I actually got problems when several threads saved data ...
4
votes
2answers
52 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
82 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 ...
12
votes
3answers
352 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
52 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
25 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
126 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
585 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
68 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
291 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
253 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
440 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
53 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
339 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
113 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
143 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
155 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
465 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 ...