DateTime objects in many programming languages describe an instant in time, expressed as a date and time of day.

learn more… | top users | synonyms

0
votes
0answers
8 views

Going through 1 week of 200k records dated by every second and mapping them to each hour of every week

This is a little net health monitoring project I made in NodeJS. It pings google every second and stores the result (true/false) along with the Date in database (MongoDB). I've collected enough data ...
3
votes
1answer
47 views

Extracting opening and closing times for each day of the week

I have these two methods: ...
8
votes
1answer
31 views

Prorated refund calculator

I wrote this little piece of script for my workplace (insurance, etc.) to help our admins, as a light and simple file I can just email to my colleagues. The purpose of it is to calculate a prorated ...
2
votes
1answer
60 views

Printing the month name for the month number

This program asks a user to input any number equal to or between 1-12. It then converts the number to a message that will be printed (Copy the program to see it yourself). Is there a way to make the ...
2
votes
2answers
58 views

Store open days and times

Currently I'm developing my business entities. I feel that the structure is a tad cumbersome. What I mean is that a store on a particular day can have different open and closing times. So it's not ...
4
votes
3answers
42 views

Checking dates against a .properties file

I am writing a script that will check the set values against a .properties file and I am just wondering if there is any nicer way to write what I have here. ...
4
votes
0answers
36 views

Get time difference and delete file [closed]

I have a function which gets the time difference between the time written in the file name and the local time at the moment the function is called. The file name looks like this: ...
2
votes
2answers
35 views

Countdown to multiple update times each day

I'm creating an update function to show my users when the next update will be available. I'm using the jQuery countdown plugin to show the time. What is a more efficient way to write this? ...
2
votes
1answer
23 views

Random date gen class. Returns a tuple of a start date and end date

Just interested in any comments about the way the code is written. I am very new to python and programming. I did think about a func with a generator, but thought this approach was better. ...
1
vote
1answer
61 views

Determining the number of days from today

Today I've got a pretty simple snippet to be reviewed. The function is extremely simple, as all it does is retrieve some entities from Core Data and then compares the ...
0
votes
3answers
82 views

convertToHHMM function

Can someone help me make a more elegant solution to this function? ...
7
votes
3answers
105 views

Simple greeting program based with timezone offset

I made a simple set of functions that returns a greeting based on the current time, the user's timezone offset, and the user's level. For context I wrote this as a part of a larger chat bot ...
5
votes
0answers
44 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
64 views

Expressing Rebol Dates in EBNF

I'm looking to define the Rebol date format in EBNF notation. I'd like as best as possible to only define valid dates—at least those that are valid in Rebol at the moment: ...
3
votes
2answers
130 views

Implementing a Yearmonth class

Recently I wrote a program that was required to handle year and month data and so I wrote this class to encapsulate that handling. What I needed was a way to initialize the ...
2
votes
1answer
28 views

Convert list of UTC to Current TimeZone

I found myself with a list of UTC timestamps and wanted to convert them into the local time zone. Using this web post as a starting point, I modified the script to grab a text file containing UTC ...
5
votes
3answers
293 views

Model interval inclusiveness in C#

This is my first attempt to model a day's time interval and the fact that the start and end are either inclusive or not: ...
6
votes
1answer
172 views

LiveDate version 2

LiveDate has the ability to display the current date either by asynchronously fetching the time from a server or by just using the client system date. It's only as ...
2
votes
1answer
47 views

Generating Calendar month information using JavaScript

I am using the below function to set month information on context passed. It is working fine, but please review it and let me know if there are any potential flaws or any improvements in this code. ...
1
vote
1answer
64 views

Track execution time using std::chrono facilities and print the execution time in a comprehensible way

The class below will be used to track the execution time of various operations. There is no need to dip into C libraries to get formatted output then. Output would be something like this: 10 ...
0
votes
2answers
36 views

Stripping time information in a DateTime object [closed]

Is there any better way to strip the time information in a DateTime Object than creating a new DateTime Object? For example, if I just want today's date and not time, is the only way is to do the ...
1
vote
1answer
45 views

Counting only weekend days between two timestamps

I am fairly new to the Groovy arena. I recently modified some code to add the following block. This code is added to remove dates we were supposed to remove from the total counts. This data goes on ...
3
votes
2answers
33 views

SQL server efficiency, comparing date time of latest record and the one under it

I have a snippet of SQL that compares the last two records and gives the datediff in seconds. However, the way I have it is quite slow, taking up to 20 seconds to execute depending on how many ...
1
vote
1answer
43 views

Implementing a date validator using enum

First and second post on the same subject. This is such a great way to learn. Once again I'm open to suggestions. I have implemented almost all of the suggestions from before, which have resulted in ...
3
votes
3answers
65 views

Triaging items according to a time threshold

I'm having this part of code which I want to make smaller, more readable and easy to manage. Any thoughts? I tried linq but got lost. ...
4
votes
1answer
116 views

Using swing and creating JPanel

I watched bunch of videos about swing and GUI in general and created my first component (correct me if it is not one). JPanel class: ...
2
votes
1answer
52 views

Date validation in Java - take two

I read through and implemented the advice I received yesterday. I would, once again, really like some input on how this can be improved. e.g. encapsulation, interfaces, abstract classes etc.. Right ...
3
votes
2answers
71 views

Validate input of month/year, otherwise set it to current month/year

Is there a cleaner way of doing this? I'm using filter_input to first check for valid input, then using it again to assign the variable. Also, my condition in ...
5
votes
2answers
130 views

Unit Tests for getting the first Monday of the month

I have an application that runs hourly, and I want to use it to also send an email at the start of the day of the first Monday of the month. I searched and found information to help me code what I ...
2
votes
1answer
72 views

Date validation in Java

I'm learning Java, and would really appreciate any tips on how to improve this code. It's just a simple date validation class. ...
5
votes
1answer
96 views

jQuery Datepicker Plugin

I created a jQuery plugin that converts a text field to a 3 drop down, datepicker. It allows the user to select a Day, Month and Year rather than type the date in an input box. The original input ...
2
votes
1answer
40 views

Extract incomplete weeks from a DateTime collection

The code below attempts to extract incomplete weeks from a List<DateTime>. For example, a list containing all the days in Jan 2015 would result in the 5th to ...
6
votes
1answer
87 views

Find the next 7 o'clock NSDate

In my very specific scenario, I need to get an NSDate holding the next time the hour will be 7 (either AM or PM). On the case that this is the first time to do ...
2
votes
1answer
139 views

My AJAX LiveDate Object

The LiveDate object displays the live current date and has a sendAjaxRequest() function dependency to send the AJAX requests. ...
6
votes
2answers
97 views

Age in years at a specific date

For eligibility to events I need to know the age of a competitor at a specific date. Now the thing is the date calculations are checked in two places, an online PHP app where the entries are ...
1
vote
0answers
67 views

Calendar application with shaky Logic

I have built a calendar application just with jQuery. The script file is on Github. The code works perfectly fine and I have tested it. Please feel free to clone and test as well. I am uncertain on ...
0
votes
2answers
80 views

Input and Validate Dates

Question: Write a function that accepts integer values for day, month and year and returns them in a valid format. If the day is above 30, then convert it to 30. If the month is above 12 then ...
4
votes
2answers
50 views

Time Code with Microsecond Conversion

The function below converts a time code into seconds, while maintaining the decimal value (fractions of seconds). The time code fed to this function will always contain microseconds. This currently ...
3
votes
4answers
675 views

Calculate next working day

I have tried to tackle this question as follows: ...
1
vote
0answers
22 views

Time calculation to identify current phase

I have a program that works by periodic phases, and I need to understand, depending on the current time, which phase should be executed. The following is not for busy wait, it's just a check. I'm ...
1
vote
2answers
122 views

Checking whether a timestamp is 10 minutes old

I have a timestamp (searchTimestamp) which I need to check to see whether it is less than 10 minutes old or not: ...
12
votes
4answers
569 views

Generating an ordinal number for the day of the month

I am relatively new to programming and came across an if statement that I believe to be a bit verbose. I have tested my code and it appears to work without any ...
2
votes
0answers
108 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 ...
7
votes
3answers
1k views

Convert Integer to Date in Java

Due to some clueless soul, we have several fields in a legacy database that uses a 6-digit integer to represent a date in (YYYYmm) format. The date field is assumed to be the last day of the given ...
2
votes
1answer
65 views

Getting duration between two dates

I'm developing on a web application where I have a start and a finish date and time and have to set the duration between it. There are inputs for dates and times. Then, I have this function which ...
2
votes
1answer
43 views

Date-filtering function

Please check if this date filtering function is inefficient code. It seems so to me, but I can't figure out the other way around it. ...
1
vote
1answer
75 views

Sort by a custom date field

I've got this code to work, but being really new to PHP, I don't know if this is proper. I've sorted a CPT loop by a custom date. I'm displaying items from most recent (or future date) to oldest if ...
3
votes
1answer
76 views

JavaScript/jQuery DatePicker

I created some functionality for JavaScript datepicker. I'm trying to store a value in the datepicker with the selected month along with which half it is. To do ...
1
vote
0answers
26 views

Complete date ranges for two years

I have array contents with some date ranges, fetched from the database: ...
3
votes
1answer
26 views

Average interval between dates with random blanks updated

After getting some help at Average interval between dates with random blanks, I rewrote most of the code. Here is the updated code: I have a spreadsheet with order date data: I need to find the ...