DateTime objects in many programming languages describe an instant in time, expressed as a date and time of day. Use on questions about reviewing code involving date/time logic.
1
vote
0answers
21 views
Correcting time in DST gap using Joda Time
We have a class which acts as a time interval, containing a LocalDate and two counts of minutes since midnight.
One of the methods on this class converts these values into two DateTimes.
Since ...
1
vote
0answers
24 views
Forecasting function using auto.arima for 15 samples of data
I have a workbook with data sampled. i have multiple samples based on date range. one sample starts from january, where other can start from february and so on. I need to build forecasting function ...
5
votes
2answers
102 views
Age verification module in Python
I wrote an age verification module in Python 2.5 . How can I improve on current_year? import time perhaps?
...
1
vote
1answer
49 views
Interpreting the time
EDIT: Alternate answer on overflow: http://stackoverflow.com/questions/38487692/how-can-i-interpret-the-time-with-less-code/38492144#38492144
But I really want to keep Jonah's answer here too. Just ...
2
votes
0answers
34 views
Java util to compare if time beyond cutoff
I have a to write a simple utility function that given a time in CST and a date in PST, tells if the date is today and if the current time is less than the cutoff (post converting cutoff to PST).
...
3
votes
1answer
69 views
Calculate working minutes between two timestamps
I've created a function to calculate the working minutes between two timestamps.
I class working minutes as those between 9am - 5pm and not on weekends or national holidays.
The holidays are those ...
3
votes
1answer
27 views
Filling in gym membership prices by joining PANDAS dataframes
I have two dataframes, df which contains a list of members in addition to the type of contract that they purchased on a given date, ...
5
votes
1answer
50 views
Translate datetime format from one standard to another
In my python code, date formats are stored as "strftime and strptime syntax". For instance %d/%m/%Y %H:%M.
On the client side, I use pickadate.js which format is ...
5
votes
1answer
213 views
Celestial age calculator
Our solar system has 8 planets, including earth. Our calendar has some very confusing concepts such as leap years, which I still don't fully understand. In fact, since where I live, we use a different ...
2
votes
2answers
108 views
Effective way to handle multiple time string to timestamp
I have 4 cases of time string as follow:
s = "July 5, 2016, 12:04 a.m."
s = "July 5, 2016, 7 a.m."
s = "July 5, 2016, midnight."
s = "July 5, 2016, noon."
I want to convert string to timestamps....
1
vote
0answers
24 views
Grouping logs and providing counts
The code is supposed to group start and end time logs and provide log counts and unique ID counts. The grouping will be variable 1 hour, 6 hours, 12 hours, 24 hours, etc.
What is the better way to ...
2
votes
1answer
21 views
Start and end times of recurring events
I'm working on a function that returns a specific set of times for a given timezone and a given frequency; day, week, month. For any given timezone and a frequency the function will return the ...
15
votes
2answers
301 views
Guitar Hero III Bot
I made a Guitar Hero III bot for PC. I was able to beat the song "Through the Fire and Flames" on Expert with the bot which can you see here.
If you watched the video, you can see that the bot misses ...
4
votes
4answers
113 views
Time difference
I'm using DateTime C#.
I have an XML file with attribute HOUR, i.e:
<MyXML>
<LastTimeTaskRun>11:50</LastTimeTaskRun>
</MyXML>
And i ...
2
votes
1answer
51 views
Checking whether a store is open or not by querying over its business hours
I currently have a method that checks if the store is open. It's working nicely, however on the main page I have quite a few stores. Whom again have different locations. Each of these locations again ...
5
votes
3answers
245 views
Transferring data for a given month from one sheet to another
I have dollar amounts sorted by month that I want to transfer from sheet entry to sheet actuals. I only want to do it for a ...
2
votes
1answer
50 views
Queries for the number of users seen each day
The below code returns an array filled with the number of users last seen for each day for $dayCount number of days that is specified via a parameter into the ...
7
votes
2answers
95 views
Formatting seconds as hours:minutes:seconds
This is basically my school homework and I want to know what to improve, and what not to do.
The homework basically is this:
You will get a input in seconds, which is supposed to be shown as H:MM:SS ...
3
votes
1answer
46 views
Efficient date-based lookup function in R
Right now this function takes an excessively long time to run, please let me know how to make it more efficient.
lunarCal is 144x7 and the ...
2
votes
1answer
65 views
Ruby class to model (pre)historical Dates with (im)precision
I am relatively new to Ruby, having worked with Rails for about 8 months.
For fun and my own education, I have written a Ruby gem (no Rails) that models dates with a precision (second, minute, hour, ...
3
votes
2answers
43 views
Finding maxDate for each entity
I have a table with (CompanyNumber, File_Date, [various financial results])
I wanted to get only the most recent set of accounts for each company.
After various ...
4
votes
2answers
74 views
Simple C# application that transfers new files (modified in the last 24 hours) from one directory to another
I'm new to C#, so I'm eager for any and all criticism/advice.
...
5
votes
1answer
48 views
Calculate attendance compliance based on attendance record
This is part of a larger working system which I'm now trying to clean up. In the interests of making the system more test-able I'm splitting up the functions which can be split, but this 100-line ...
3
votes
1answer
45 views
Python get UTC offset for when only naive date time objects are available
The function below is designed to return a UTC offset string, in the form used widely by timestamps, of the user's current time for when only naive date time objects are available (no time zone ...
1
vote
1answer
37 views
Sort by year and day descending, yet time ascending
I recently discovered a hugely inefficient portion of code in my program, and have gone about rewriting it. I am however, not quite sure if the rewritten program actually does exactly what I want, due ...
1
vote
1answer
37 views
Building a 2D array “month view” for a given date
I am working on a calendar widget for a project. For any given date, I need to build a 2D array representing the "Month" that the date falls in, where the rows represent weeks in the month and the ...
5
votes
1answer
67 views
Merging trips to the same location with overlapping dates
I have a SQLite database that only contains the holidays for 1 user.
I have a new Trip object (newTrip) that has a ...
5
votes
1answer
43 views
Generate dyamic 'week of' date range
I was in need of a method to dynamically generate a week range, so that the view reads something like "Week of May 16 - 22" and updates automatically. Here's the helper method I came up with, but I'm ...
1
vote
2answers
54 views
AM/PM to 24 hour time conversion
I recently joined the website www.hackerrank.com for programming challenges, and one of them was a time conversion from 12 hour to 24 hour. Rather than using the ...
3
votes
1answer
56 views
Spring controller code to group information by date
I'm using the Spring Framework in my web application and I'm curious as to whether my controller implementations are good or not.
I've used many Hashmaps to make a object that serves my purpose for ...
2
votes
2answers
67 views
Calculate daily average for selected period in PHP
I would like to calculate the average for the same days (e.g. Monday, Tuesday, etc) in a selected period:
...
3
votes
1answer
53 views
Splitting a date-range - can it be improved somehow?
I've created a method to split a date range into a collection of date-arrays. These arrays consist of two timestamps.
Example:
...
2
votes
3answers
45 views
Validating five date fields in Angular.js
So I have following piece of code which basically validates five date fields in angular service.
But the catch is that there may be one to five field(s) visible on the screen based on some other ...
2
votes
1answer
35 views
Printing the start and end dates of the most recent eight weeks
I have a table with columns dated by week that changes dynamically each day. Currently, I am using the following php code to get the proper dates for the past eight weeks:
...
6
votes
2answers
101 views
Populating an array with times with half hour interval between them
So for example, getTimes("12:00", "15:30"); should return:
["12:00", "12:30", "13:00", "13:30", "14:00", "14:30", "15:00", "15:30"]
The input parameters are always ...
4
votes
1answer
63 views
12/24h Time format converter
I am really new at this and I was wondering if there is a more efficient way of writing this code, which converts time format to 12-hour from 24-hour format, and vice-versa.
For example ...
5
votes
1answer
59 views
Let's have a meetup
Problem statement:
Calculate the date of meetups.
Typically meetups happen on the same day of the week.
Examples are
the first Monday
the third Tuesday
the Wednesteenth
the ...
4
votes
1answer
75 views
JavaScript calendar widget
I'd like to know how I can refactor my JS code for usability.
Currently my JavaScript uses some HTML to build out a simple calendar with the following functionality:
a. opens into the current month ...
1
vote
2answers
33 views
2
votes
0answers
39 views
Few DatePickers and TimePickers in Android activity
I'm developing an Android activity which asks user to enter start and end dates and times in order to know a certain period of time. After picking start date, user picks start time, and then he/she ...
1
vote
0answers
14 views
Table Trigger to update date columns
I've created the following trigger to force two columns (date_edited and date_deleted) to have the ...
7
votes
7answers
1k views
5
votes
2answers
66 views
Time manipulation for notification reminders
I'm new to programming, Stack Overflow and Code Review. I was encouraged to post this method here based on a question I posted on StackOverflow here. Let me know if you have tips for improving this ...
6
votes
3answers
96 views
Find the date for the nearest day of the week, in this case Fri & Sat
General objective: Find the date (day of the month) of the nearest specified day of the week and output.
More specifically: Focusing on events which take place every Fri & Sat, want the page to ...
4
votes
4answers
312 views
Converting the DateTime to and from Unix epoch times
I'm currently working on a thing I needed this feature for. Essentially, these are two methods to convert DateTime objects to and from the Unix epoch time (two ...
0
votes
1answer
40 views
Convert MS SQL datetime to Oracle varchar(32) interval
I have a query against an MS SQL database that takes the resulting dataset and stores it in an Oracle database table which then gets joined to another Oracle table using the column ...
2
votes
0answers
19 views
Generating days in a specific range
I have a query in MSSQL, where I get a summary by days from a range in a table, and this is in union with other queries. This query is used to generate days in a specific range, then add the registry ...
5
votes
3answers
167 views
Getting the business day of the month
I'm working on figuring out what the current 'business' day of the month it is. For instance, if it's the 20th, but there are 3 weekends, it would be the 14th business day of the month.
Is there a ...
3
votes
0answers
96 views
C++ time types and format conversions
I wrote a small header-only C++11 header for converting between various C++ time formats. Here's the code in question:
...
4
votes
2answers
72 views
Calculate the difference between current date and age from personal ID
The goal is to show message for users that are less 25 years old. The personal ID consists of 081010333333, where 08year, 10month, 10date. I made code and it's very messy. So the question is: how to ...