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.

65 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
130 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
0answers
69 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
52 views

Calculate age from birthday in C#

For a project I'm working on, I need to calculate the age of users based on their birthday (which is a DateTime object). with a few requirements: the output must be in french (the entire project is ...
3
votes
1answer
220 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 ...
3
votes
0answers
103 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
490 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
4k 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 ...
3
votes
0answers
466 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
943 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
174 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
72 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
92 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
61 views

Creating calendar - Speeding up PHP script

I'm working on a calendar for my office. Every people has his own column and there is a line for every day. There are some periodic date, where, for example, given people have to be working on the ...
2
votes
1answer
36 views

PowerShell - calculate occurences of Friday the 13th between (including) two given years with builtin and without builtin

It's me again, talented programming beginner fast-learner, so I have overcomed yet another self-imposed programming challenge, I have developped two algorithms to calculate occurrences of Friday the ...
2
votes
0answers
41 views

Fastest conversion of ISO 8601 string into javascript Date object

On StackOverflow I got a great answer to a question I had about creating a Date object from an ISO 8601 string with the ability to reposition into local time. From there I wanted to see if I could ...
2
votes
0answers
40 views

Generate ISO 8601 Duration String from Two Date Objects

I've written a function which should generate an ISO 8601 duration string, given two Dates as input. ...
2
votes
0answers
48 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
70 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
183 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
262 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
1k 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
0answers
125 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
91 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
35 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
230 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
52 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
531 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
75 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
445 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
416 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
29 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
109 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
81 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
27 views

JavaScript date format string to php date format string convert

Please find the following scenario, I've dynamic JS date format string from API but I am looking for the best way to convert the format that accepts in PHP date format. For now, I wrote it my own way ...
1
vote
0answers
48 views

PowerShell - Calculating date difference between two given dates in days without builtin and with builtin

The title says it all, I have written two scripts to calculate dates to test my abilities in programming, one from scratch, without [DateTime], New-TimeSpan and even [math]::Ceiling, and it's really ...
1
vote
0answers
21 views

Transforming NodaTime ZoneIntervals, version 2

Version 1 may be found here. I have implemented the suggestions by Jon Skeet, plus some of my own. Key differences between versions: ZonedDateRange class is now immutable. LocalDate variables no ...
1
vote
0answers
74 views

Running some code every day at certain times

I am currently developing a windows service in C# which is supposed to run a data import every day at configurable times. For this purpose I have created a class "ExecutionTime" which contains the ...
1
vote
0answers
1k 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
76 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
62 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
519 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
353 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
169 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 ...