Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [datetime]

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.

60 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
119 views

Expressing Rebol Dates in BNF

I'm looking to define the Rebol date format in BNF notation (as adapted for Rebol Parse). I'd like as best as possible to only define valid dates—at least those that are valid in Rebol at the moment: ...
4
votes
1answer
36 views

Calculate implicit dates

I need help to simplify this code about implicit date calculation. The context: I have sentences with implicit and explicit dates. For instance: "From the 5th to the 7th of September 2017, the ...
4
votes
0answers
65 views

Game clock with configurable rate

Edit: Licensed source can be found here. The intent behind this class is to allow different game systems to run at their own clock rate. The physics integration rate should not be connected to the ...
3
votes
0answers
102 views

Custom Day of the Week Manipulation

The function serves two purposes as follows: When dealing with the day of the week, Python will always assign 0 to Sunday and 6 to Saturday and I want to change that. The first part of the code is ...
3
votes
0answers
300 views

Timepicker React component

I have developed a simple timepicker component. I did this only for learning and getting more familiar with reactjs. The feature this timepicker will have a) Select time in AM and PM b) Convert am/...
3
votes
0answers
441 views

pandas time-based qcut

I have a dataframe pairs where each row is a transaction with corresponding price and date. Now, I need to assign each transaction to a quintile (add a new column), ...
3
votes
0answers
822 views

Convert date time string with non standard timezone offset in C#

I couldn't find a .NET date format type to handle dates in format I need to process, they sometimes have time zone offset with +/- prefix followed by 3 digits for the number of minutes timezone is ...
3
votes
0answers
151 views

Perl nagios plugin to query an api, obtain date from json, and determine if the date is within thresholds

This is an update of Using an API to obtain JSON data and get the date string and determine if data is stale This is a nagios check that will use an API URL, get JSON data, flatten the data into a ...
3
votes
0answers
2k 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 ...
3
votes
0answers
71 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. ...
3
votes
0answers
1k views

Map Events From calendar provider to dates in gridview

I working on a calendar app on Android, using roomaorama, which is nice. I am fetching all the events from Events table in Calendar provider once which seems not good performance wise. The library ...
3
votes
0answers
91 views

Calculate compilation time from AssemblyVersion attribute

In my program, I display the compilation time which is calculated from the AssemblyVersion attribute. The attribute is set to automatically generate a version ...
3
votes
0answers
1k views

Implementing “day wise task management” system using Django and AngularJS

I have a Task model in Django which looks like the following: ...
2
votes
0answers
45 views

Calculate reservation cancellation penalty based on date difference

The website I'm developing allows customers to book an appointment. They can also cancel their appointment with the following rules: if the appointment is cancelled between 48 hours and 1 hour in ...
2
votes
0answers
69 views

Code to email past-due accounts

I am using this syntax to query a table and return a record set and if the number of times total the customer has been emailed is less than 5, send an email with a canned response. If the number of ...
2
votes
0answers
26 views

Getting service rate based on time/day of service

I have a long roster where I'd like to categorize the rates by time/day of service. Most shifts ends the same date but there are some special cases where the shift ends on a different date. I have to ...
2
votes
0answers
68 views

A portable cross platform C++17 method to retrieve the current date and time

I am working on a utility function to get the current date and time. My objective is to do this in a generic and portable way. I would like to stay way from platform specific code to allow the ...
2
votes
0answers
131 views

PHP project with Google Calendar API

I'm playing with a simple (for now) project in PHP with Google Calendar API. I have posted the code here in order to improve my programming style about whatever you think it's worth suggesting. Thank ...
2
votes
0answers
550 views

Event Calendar in JS, CSS, and HTML

I repeated a lot of code here and I'm trying to use more ES6 but I'm not sure where I should have used it in my code. I'd appreciate any input on where I could improve. GitHub ...
2
votes
1answer
144 views

Fuzzy Humanize date using Moment.js for datatable searching

In my JS project, I am using datatable plugin to show data where I have a date column which users can filter/search. In order to help users to search using a logical string such as ...
2
votes
0answers
96 views

PostgreSQL: maintaining non-overlapping temporal ranges

I have to store some temporal meta data used primarily in bulk processing of a time-series (sensor measurements). Each value of this meta data is valid for a potentially half-open range of time. ...
2
votes
0answers
86 views

Copy Excel file and make multiple daily versions

Every month my department has to generate blank upload files (xlsx) for each day of the month. The following code helps this process by copying a template, iterating through the number of days of the ...
2
votes
0answers
34 views

Set a time based on hh:mm length, or set time length based on time

I am using Ionic 3, Angular 5, and moment-timezone. I have a form input that displays EndTime (in the format of 01:23 AM) and another that display the length (in ...
2
votes
0answers
222 views

Convert python's strftime directives to user-friendly format examples

I'm converting python's very un user-friendly strftime date time directives to user-friendly formats so that users of an API will know how to format a date if they send an invalid format. My thinking ...
2
votes
0answers
51 views

PDcurses clock using abstract factory design

I am currently learning how to use PDcurses and decided to make a clock with it. **NOTE: this Watch that uses the abstract factory design pattern is not the same as this question!!. This question is a ...
2
votes
0answers
3k views

Regex credit card expiry date auto format

I'm trying to write a function that will get content from input element and try to format numbers entered in input box in MM/YY. Following is a solution that I have, and I want to reduce the number of ...
2
votes
0answers
436 views

Optimize platform independent GetTickCount()

I used this method as a platform independent tick counter. Unfortunately, it consumes ~10 % cpu time in one of my methods. Is there a faster way to solve the issue? ...
2
votes
0answers
69 views

Time Schedule Intersection version 2

Time schedule intersection in my original question I gave an answer which has \$O(n^2)\$ complexity. Here is the new version of the same problem. I'm trying to get to O(N+K). please review the code ...
2
votes
0answers
366 views

Convert FoxPro/dBase DATETIME field to Win32 SYSTEMTIME struct

I'm trying to write a complete driver for Visual FoxPro's DBF format for Win32. I found that the way that fields of the DATETIME type are stored in dBase files is ...
2
votes
0answers
40 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
0answers
368 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 ...
2
votes
0answers
25 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 ...
2
votes
0answers
108 views

Weather Application - Reavling Module Pattern

I'm trying to practice and learn design patterns, and I decided to create a weather app using the revealing module pattern. How can I improve on this, and what mistakes did I make? Main.js ...
2
votes
0answers
80 views

PHP cron job for updating broadcast status

I am currently working on a re-occurring broadcast schedule. The whole idea is to setup a cron/task job that will update the broadcast flag "isLive" in a database table. Are there other options to ...
2
votes
0answers
46 views

Complete date ranges for two years

I have array contents with some date ranges, fetched from the database: ...
1
vote
1answer
19 views

Date Class, implemented

I'm implementing this date class based on <ctime> I'll appreciate your comments, critics and advice. Please review, thank you!. Date.h ...
1
vote
0answers
33 views

Determining daylight-saving time in Central European Time

The following constellation: Our applications passes date&time around (in the most horrible way possible). We want to simplify this. Instead of a culture-specific string like '31.12.2019', we're ...
1
vote
0answers
278 views

Retrieving date and time from Datepicker and Timepicker and then converting it to milliseconds

I currently have an Android Activity that allows the users to select the startDate, endDate, ...
1
vote
0answers
48 views

JavaScript time series data combination

I've written code that performs a merge of two streams of sorted time series data. The first stream is taken to be the primary and any successive streams are merged into it, using the nearest ...
1
vote
0answers
59 views

Digital clock with many functions - follow-up

This is a follow-up from Digital clock with many functions I used the review mentioned above to optimize the code, but the code can still be made better. I made a digital clock with the use of an RTC ...
1
vote
0answers
344 views

Retrieving localized Days of Week in PHP : setlocale VS IntlDateFormatter

I'm trying to find a good way to dynamically print a selection of localized days of week without resorting to an hard-coded array per language, leveraging locale mechanisms instead. Up until now, I'...
1
vote
0answers
323 views

Core of a text based game displaying graphics in pygame

I'm working on a silly personal project, - a text based game with minimal graphics such as characters (people, not the text), enemies, gear, little effects. But the core of the game is the text and ...
1
vote
0answers
166 views

Pausing task until designated time using sleep()

I have been playing around with schedule from GitHub. How can I improve the code? ...
1
vote
0answers
55 views

Recursive time formatter

This is small utility class I made format.utility.ts. There are some other one off utility methods in here I removed for this. The one in question is ...
1
vote
0answers
66 views

Implement running hours function in PowerShell

So I am trying to create a function in PowerShell that: Takes start time in form HHmm to denote beginning of time window Takes an end time in format HHmm to denote end of time window Calling the ...
1
vote
0answers
311 views

Handler for a UI to select multiple days of the week for notifications

In the app I am currently working on, there is a part where user can set multiple local notifications for specific weekdays. The array of buttons is represented by a separate class, which utilises ...
1
vote
0answers
89 views

Watch that uses the abstract factory design pattern

I have wrote code for a Watch that utilizes the abstract design pattern and would like to get some feedback on the code, be as harsh as you can. Also, I would like ...
1
vote
0answers
38 views

Calculate time to the offset of another time zone

I have a time stamp with UTC +0, i.e. time_stamp = Sat, 08 Apr 2017 16:01:16 UTC +00:00 I'm converting the time/date part of the time stamp to another time zone'...
1
vote
0answers
497 views

getDayOfTheWeek function, without using built-in date libraries

I have an assignment to create a method to retrieve the proper day of the week for any given date, without using the Java calendar. After countless hours of trying to implement the algorithm in the ...
1
vote
0answers
1k views

C# Regex to match UTC dates

Made the following regex strings to match for typical UTC dates. I'd appreciate it if you guys can let me know if it seems fine and not too lengthy. ...