Skip to main content

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.

45 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
5k 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 ...
monkeyman905's user avatar
5 votes
0 answers
159 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: ...
rgchris's user avatar
  • 489
4 votes
0 answers
97 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 ...
user avatar
3 votes
0 answers
49 views

Calculate difference between dates and output desired result like (Today, Tomorrow, or 20 Days from now)

I'm writing a task list tracker with VueJS. Each task has a Frequency label (How often it needs to be done), Last completed date label (When the task was completed ...
babis95's user avatar
  • 131
3 votes
0 answers
273 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 ...
Benjie Wheeler's user avatar
3 votes
0 answers
414 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 ...
GollyJer's user avatar
  • 365
3 votes
0 answers
3k 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 ...
icewizard's user avatar
  • 141
3 votes
0 answers
115 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 ...
Longroadahead's user avatar
3 votes
0 answers
731 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/...
Priyanka's user avatar
  • 211
3 votes
0 answers
6k 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 ...
Maulik Suchak's user avatar
3 votes
0 answers
505 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), ...
Philipp_Kats's user avatar
3 votes
0 answers
1k 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 ...
Malcolm McCaffery's user avatar
3 votes
0 answers
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 ...
Raghunandan Kavi's user avatar
3 votes
0 answers
107 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 ...
Kevin Vuilleumier's user avatar
3 votes
0 answers
1k views

Implementing "day wise task management" system using Django and AngularJS

I have a Task model in Django which looks like the following: ...
pankaj28843's user avatar
2 votes
0 answers
142 views

Rust implementation of an algorithm I invented (RANDEVU) #2

I came up with an algorithm and created a Rust implementation of it. I've already posted it for code review previously but created another post since I've made many changes to it, including the ones ...
TypicalHog's user avatar
2 votes
0 answers
108 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 ...
csi_bern's user avatar
2 votes
0 answers
44 views

Analog Clock for WebAssembly in AEC

I've ported the Analog Clock program written in AEC from Linux to WebAssembly. You can see the live version. ...
FlatAssembler's user avatar
2 votes
0 answers
84 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. ...
Benny Powers's user avatar
2 votes
0 answers
51 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 ...
Bas Velden's user avatar
2 votes
0 answers
76 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 ...
user2676140's user avatar
2 votes
0 answers
33 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 ...
chase devilla's user avatar
2 votes
0 answers
808 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 ...
Francis Cugler's user avatar
2 votes
0 answers
456 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 ...
GabrieleMartini's user avatar
2 votes
0 answers
180 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. ...
ytfntk's user avatar
  • 21
2 votes
0 answers
111 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 ...
Nahuatl's user avatar
  • 131
2 votes
0 answers
57 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 ...
derrickrozay's user avatar
2 votes
0 answers
255 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 ...
Dan Bovey's user avatar
2 votes
0 answers
68 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 ...
globalturist's user avatar
2 votes
0 answers
1k 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? ...
dgrat's user avatar
  • 491
2 votes
0 answers
90 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 ...
Gilad's user avatar
  • 5,273
2 votes
0 answers
45 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 ...
Sitz Blogz's user avatar
2 votes
0 answers
425 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 ...
apex39's user avatar
  • 322
2 votes
0 answers
32 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 ...
Miguel Avendaño's user avatar
2 votes
0 answers
114 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 ...
Kieran's user avatar
  • 21
2 votes
0 answers
91 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 ...
Ben Isaac's user avatar
2 votes
0 answers
48 views

Complete date ranges for two years

I have array contents with some date ranges, fetched from the database: ...
Fatimah Wulandari's user avatar
1 vote
0 answers
646 views

deprecated strftime in PHP 8.1

I saw that strftime is deprecated in PHP 8.1. I saw I can use a class include in intl but I'm not sure to understand how to use It. On my site I use this function with the array $datesToConvert{020222,...
Nasty Phoenix's user avatar
1 vote
0 answers
69 views

simulation of updating a dataset from real time data

In this code (reproducible example) I want to generate a dataframe composed by random dates in the first col, and by random numbers (in reality they will be generate from a socket) in the second ...
Carlo's user avatar
  • 111
1 vote
0 answers
805 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 ...
Ξένη Γήινος's user avatar
1 vote
0 answers
65 views

Code for creating a dialog for choosing a date

I have code that creates an AlertDialog to select a date by a user. I ran into a problem that this code began to take up a lot of space. Could you offer ideas on how to shorten this code / put it into ...
Destroyer's user avatar
  • 477
1 vote
0 answers
283 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 ...
Chris's user avatar
  • 111
1 vote
0 answers
3k 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, ...
Issaki's user avatar
  • 131
1 vote
0 answers
843 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 ...
Kufo0's user avatar
  • 19
1 vote
0 answers
2k 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. ...
Pants's user avatar
  • 111