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.

learn more… | top users | synonyms

1
vote
1answer
23 views

Rake task to send users a reminder to post with conditions

I am implementing a feature that reminds users to make a post via email if the user has set daily reminders to true he has not posted yet today and if the current hour matches when he would like ...
2
votes
1answer
37 views

“Can a list of meetings all be scheduled in a conference room?”

I was given this question at an interview for a position I just got rejected by, so looking to improve and see what better answers there are! ...
3
votes
1answer
45 views

Stored procedure to classify policies by sales date

Currently this is the store procedure I am working on, it is working according to some testing that was done. I feel that it could be improved though, could use some optimization, feedback or ...
2
votes
1answer
61 views

Generating calendar months for a datepicker

I got a problem I'm finding pretty hard to solve. I'm trying to generate calendar months for a datepicker but at only 12 months I see a perf of around ~4-7ms. This doesn't sound like a problem but it ...
5
votes
1answer
117 views

Create array of date pairs for next 10 days

I wrote the below function which successfully creates pairs of dates in the format I need. However, I'm fairly new to Python and feel there must be a way to make this easier to read. Can this code be ...
5
votes
1answer
103 views

Is date 18+ years old?

Considering that: the passed parameters are all numbers the passed date is a valid date It should return: true if the date is 18 or more years old ...
0
votes
1answer
36 views

Four jQuery date time pickers

I'm using the Jquery date time picker link here In the four methods below I am initializing the DT pickers but they are all pretty similar except for the ID in the ...
3
votes
2answers
64 views

Convert a start and end date chosen by a user to epoch

This method allows the user to choose a start and end date in human readable form, then convert it to epoch. The method will return a array of longs composed by the ...
1
vote
1answer
35 views

Getting last and this monday as Unix timestamp in JavaScript

This is how I achieved it: ...
3
votes
0answers
66 views

Todo list with calendar

The app is a todo list with a three-day calendar. Users can add and remove lists and it's all stored in local storage. My aim was to use vanilla JS but I did use jQuery for the date picker. I'm just ...
5
votes
2answers
174 views

Custom sorting of dates

I have implemented a class which implements a list of my custom DateObj. I have sorted the list in a peculiar manner based on the current month. I achieved my ...
7
votes
2answers
579 views

Simple DateTime abstraction

Some of my tests require that I need to test the date time results (like time stamps etc.). In order to be able to test the date time string I created a simple ...
1
vote
0answers
27 views

Calculation of duration between two timestamps in different rows

In my sample data table below, all datatypes are varchar(255). ...
5
votes
4answers
323 views

Comparing dates (without the time part) in Java

In my current project, I have to deal a lot with dates, especially checking if the date entered by user is today, or max one year from today etc. As I find the datetime API of Java7 (which I ...
6
votes
1answer
68 views

JavaScript DateTime library

To keep it succinct, I created a simple way to input dates and times into an input box without worrying about formatting. As an alternative to date time pickers, dropdowns and all the other various ...
6
votes
2answers
79 views

Hours:Minutes Addition

I wrote this simple page to help at work, and as an exercise to get more familiar with JavaScript. I'm especially interested in help with style and structure - is this "standard"? I know the input ...
7
votes
2answers
47 views

Execute every Monday that is not the Monday following last Saturday in month

I think the following is good but wondering if it can be simplified or improved. My condition for code execution is the following: It is a Monday AND It is not the Monday following the last Saturday ...
6
votes
3answers
175 views

Ordering an un-ambiguous scrambled date

A date is un-ambiguous when each number may be decided to be day or month or year given the range limitation of these numbers. For example \$14\$ cannot be a month number \$2008\$ cannot be ...
14
votes
4answers
957 views

Enter year, date, and month in any order, I'll organize it

I would like some advice on how I could make it less repetitive and use more functions and classes. ...
6
votes
2answers
29 views

Checking and converting [[HH:]MM:]SS input format

I would like to use the following routine in my job submission bash script which expects the allowed walltime in the format [[HH:]MM:]SS. (Brackets indicating ...
11
votes
4answers
473 views

Function to format the local time

This is a statement that I use a lot in my code base: (LocalDateTime.now()).format(DateTimeFormatter.ofPattern("ssmmHHddMMMuu")) Should I create a static method ...
4
votes
1answer
516 views

Deleting millions of rows from a MSSQL server table

This SQL query took 38 minutes to delete just 10K of rows. How can I optimize it? Index already exists for CREATEDATE from ...
4
votes
3answers
70 views

NTP Clock on a Raspberry Pi

I've been tinkering around with making a fancy clock on a Raspberry Pi B. This little application will sync the Pi's time with an NTP server, then display it using ...
4
votes
0answers
44 views

Multi-function clock GUI

I was sitting in my bedroom, looking at my Powers of 2 clock sitting next to my radio, under my analog clock on the wall, and wondered to myself: "Why have all these different clocks when I can have ...
6
votes
1answer
176 views

Combining two clock tick vectors with NumPy

I have two long (7683200 length) 1D arrays corresponding to two clock cycles, that I wish to combine into single 1D array. The clock_ticks_fine cycles between ...
4
votes
1answer
28 views

Selecting time metadata off a calendar table

I have a report on SSRS (that's SQL Server Reporting Services) that I need to be able to parameterize so that it can run for.. Yesterday (scheduled every morning) The week that just elapsed ...
4
votes
1answer
93 views

Seven-segment display GUI

I am building a GUI to display a digital clock face (four seven segment displays), and I have a selector to switch between 12/24-hour formats. I have working code to show both formats, but it is ...
3
votes
2answers
42 views

Return the first number found greater than the provided input number (13 digits)

This script converts the numbers to be at least 13 characters long (for UNIX_MS strings). For use with timestamps, I'm having issues with it being very slow. I wanted an alternative to grepping for ...
3
votes
0answers
40 views

A version of the Pebble Big Time watch face that also displays the date

I'm seeking style pointers, bugs, memory leaks, incorrect usage etc. ...
5
votes
3answers
216 views

Sorting a list based on date and time

I have a class that is used to basically store samples from data being read from a system. Within that class is a property that I use to store the date and time of that sample: ...
4
votes
3answers
316 views

12 hours to 24 hours conversion function

I have made a time format converter which converts 12 hour format to 24 hour format. My convert_to_24() takes a string in format of ...
5
votes
2answers
163 views

Counting e-mails in a mailbox for each hour

Pardon if this is silly, but I'm pretty new to coding. I have this code, that works, but I feel like it could be tighter than this, I just can't seem to get it to work any other way. The idea is to ...
1
vote
3answers
109 views

Age-Calculator Program

This is a code to calculate somebody's age. It takes 2 inputs: A specific date (to calculate your age at a specific time or the current time). The birth date. ...
0
votes
1answer
15 views

Configuring a date picker with support for disabled dates

I'd like to see if I can somehow make this loop more effective (smaller?). I'm using MultiDatesPicker to make a reservation plugin. And I've set everything right, and everything works, but I'd like to ...
4
votes
1answer
82 views

Toggle functions for drop down for a clock time widget

I'm fairly new to JQuery/JavaScript and I'm trying to refactor the following code: ...
2
votes
1answer
66 views

Java loop extracting month and year between two dates

I have a ContratMercan with 2 Timestamps containing start and ...
4
votes
2answers
181 views

Checking for valid date range in Rails

I am getting a date range from form inputs - the "from" month, day, and year, and the "to" month, day, and year, and then running a report on data for within that date range. I want to first check ...
3
votes
2answers
199 views

Converting a 12 hour time string to a 24 hour time string

Input - Standard input - HH:MM:SS[AM|PM] format. Examples: 12:00:00AM 12:00:00PM 01:00:10AM 01:00:10PM The program reads one line per instance. Output - military format (24 hour format): ...
4
votes
1answer
65 views

Get all remaining days of the week

What this function does it's to return an array of remaining dates that are e.g. Mondays. Is this really the best way to do that? ...
7
votes
1answer
92 views

JavaScript date validation

I have a date control which has a dropdown for each date, month and year. The issue is, I can select 31st Nov. 2015 as well, and when I create date object, I get 1st Dec. 2015. Example ...
4
votes
1answer
130 views

12-week staffing forecast LINQ query

I have a LINQ query that I am having trouble optimizing and takes about 5.5 seconds to run. I am using a view called StaffingResourceData and a table called StaffingForecasts. Each StaffingResource ...
3
votes
1answer
63 views

“Day-of-the-week-finder”

I'm new to Python/Programming and wrote this simple "Day of the week/Holiday finder" script. Ideally I'd use something so I can have a little widget on my desktop, but right now I'm looking for any ...
2
votes
1answer
50 views

Sum an array of video lengths in JavaScript into HH:MM:SS

I am trying to learn functional programming in JavaScript, and saw a little task on Twitter that I wanted to have a go at: ...
6
votes
1answer
72 views

Plotting level and temperature data from many Excel sheets

I've been working on a code that reads in all the sheets of an Excel workbook, where the first two columns in each sheet are "Date" and "Time", and the next two columns are either "Level" and ...
1
vote
2answers
35 views

Remove (not extract) timestamp from HTML string

I've got strings coming from irregularly and ugly formatted HTML sites, that contain a timestamp. I am interested in removing the timestamp entirely and get all the rest. ...
2
votes
2answers
46 views

Simple ConsoleWorker

This class updates the console's title so it can tell the person using it the programs uptime, which can be pretty useful. The class holds a timer and each time the timer executes it will call the ...
3
votes
2answers
36 views

Moving a clock forward

I am taking a Ruby class and our assignment was to write a class that takes two users inputs (1. the time, 2. the amount of minutes to move forward). Then based on the two inputs forward the time by ...
1
vote
1answer
58 views

Filter to convert duration to hours — in controller or model?

I have this before_action method : ...
2
votes
2answers
43 views

Finding the date from “2nd Friday of X month”-style input

I've been working through some puzzles from exercism.io. Current puzzle asks me to return a date() from input that essentially says "The 3rd Friday of December" or ...
2
votes
1answer
46 views

java.sql.Timestamps: There's gotta be an easier way

I have a function that counts how many "assists" a team performs during the course of their day. The way I've written it feels bulky and inefficient using GregorianCalendar. Basically, the ...