All Questions
32 questions
3
votes
1
answer
266
views
PHP Laravel Check if given date is a week or a regular day
I have a problem. In my project the user can copy a menu for a specific day or for a specific week. The value that will be sent to the back-end will be something like:
...
1
vote
1
answer
97
views
Parse a selection of date formats
This Bash program parses day, month, year and month and year from arguments:
...
7
votes
1
answer
335
views
Interpret a date from a string of digits
I developed a function that, from a given sequence of digits, extracts the date and reformat it.
This is the code:
...
4
votes
3
answers
418
views
Python process tracklist, get cumulative timestamp of each track
The code below parses a tracklist (sample input below) and generates a six-member tuple, including cumulative timestamps in mm:ss. (sample output at bottom).
...
11
votes
3
answers
4k
views
Convert a string like 4h53m12s to a total number of seconds in JavaScript
At the moment I have this:
...
2
votes
2
answers
2k
views
Parse date format in Pandas using Python
I have a column in a Pandas Dataframe containing birth dates in object/string format:
0 16MAR39
1 21JAN56
2 18NOV51
3 05MAR64
4 05JUN48
I want to ...
2
votes
1
answer
91
views
Determine if a String can be parsed to LocalDateTime or Int
I have the following kotlin function that takes in a string "value", then attempts to parse "value" as both a LocalDateTime and an Int. It returns a Pair of the parsed value of "value" and an enum ...
3
votes
2
answers
66
views
Parse a date in various formats
I have a problem similar to the question, namely reading in text which describes a date - in various formats. I want to use the parseTimeM function from ...
1
vote
1
answer
233
views
Parsing a string to a java LocalTime
I have a method that can take in a time string in one of the following formats:
HHmmss - e.g. 073055 = 07:30:55
...
10
votes
2
answers
5k
views
Javascript cron-to-human-readable translator
I'm developing a webpage displaying the scheduled pipelines from all projects of a GitLab instance. The scheduled time is expressed using CRON expressions, i.e. five digits as follows:
Because not ...
2
votes
1
answer
88
views
Crontab datetime field pattern parser in Rust
@angus on Unix.SE implemented a tool in C to list upcoming cron jobs in response to a question. I've re-implemented the basic functionality (showing only the next cron job) in Rust, using ...
2
votes
2
answers
73
views
Parsing date strings, inferring the year such that the date is not in the future
I got this program that I am working on and in it, I got a section that has a try statement and two error except statements.
...
4
votes
2
answers
176
views
Function to convert strings from hmmss, mmss, ss format to milliseconds
Here's the current logic to convert strings in the format hh:mm:ss, mm:ss or ss to ...
5
votes
2
answers
409
views
Grouping work hours for consecutive days
Problem Description
The problem was initially posted here: Parse and clean up text block of store hours in Python.
Given the following multi-line string:
...
2
votes
1
answer
8k
views
Parse through text and extract dates in uniform format
I wrote a script to parse through text and extract all the dates. I would like it to be able to find as many different ways of writing text in dates as possible while containing as few false negatives ...
5
votes
1
answer
330
views
Parse and format date
I have the following code for taking a date in the form of a string yyyy-MM-dd HH:mm:ss (UTC timezone) and turning it into ...
3
votes
2
answers
503
views
Article date extractor
I am quite new to Rust and this is my first library written in it. It's an article date extractor heavily inspired by the original Python library as well as its Haskell port.
It is fairly small and ...
4
votes
0
answers
60
views
Method that gets the date from a file according to the name of the client [closed]
I have in this class bellow, a method that gets the date from a file according to the name of the client. For each client, the method to extract the date is different. I want to use heritage or any ...
5
votes
1
answer
563
views
Track hours worked total or per month
I track the hours that I have worked on something in an Excel sheet (actually Google Spreadsheet, but semantics). This is tracked in the following format:
Date | Start (time) | End (time) | ...
7
votes
1
answer
186
views
Converting a 12h clock to 24h clock
I started picking up Rust on my free time, and I'm curious about what style errors have I made and where should I improve as a programmer.
The problem is from HackerRank and very simple: there is a ...
8
votes
1
answer
198
views
Log sorting program
This is my first ever program written in Rust (after reading the book). It is small tool to sort all lines from stdin according to two criteria. First one is time ...
6
votes
2
answers
897
views
Parsing Day Range with Time in Ruby
I need to shorten/simplify this code:
...
3
votes
2
answers
2k
views
Effective way to handle multiple time string to timestamp
I have 4 cases of time string as follow:
s = "July 5, 2016, 12:04 a.m."
s = "July 5, 2016, 7 a.m."
s = "July 5, 2016, midnight."
s = "July 5, 2016, noon."
I want to convert string to timestamps. ...
3
votes
2
answers
52
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 ...
0
votes
2
answers
3k
views
Extracting a date and time from a log file
I am trying to make my code as legible as possible, and today I wrote the following snippet and I'm unsure as to whether it can be improved in an obvious way. There's always room for improvement, of ...
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:
...
7
votes
3
answers
362
views
Parsing dates from an OCR application
I wrote this code to parse dates from the output of the OCR, which means that the obtained date can be literally anything, so I put some restrictions in place:
Date is the the format of: ...
3
votes
3
answers
1k
views
Parsing and formatting a time two ways (perfectionistic approach)
I'm still not satisfied by the readability of the code. The wanted behavior which would be self descriptive would sound like: "I've two fields; one is for the date and one for the hour. This two ...
3
votes
4
answers
1k
views
Optimize parsing more and more
I have the below C# code for parsing. Do you think this is most optimized or should I use a generic method in these functions themselves?
...
4
votes
1
answer
1k
views
Parsing time ranges with PyParsing
The following code is intended to parse a string of the following format and return whether the current time falls in that window:
...
4
votes
1
answer
79
views
Extracting performance statistics from FTP session transcript
I've borrowed and written the following code to output the disconnect time. All works well but I'm curious as to how I could tighten/ shorten the code. If anyone feels like having some fun then I'd ...
6
votes
1
answer
275
views
"Best before" puzzle
I'm new To C++ and decided to have a go at the Spotify challenges on their website.
I have now finished but I get the feeling my code is just terrible. I'm guessing it would be very hard for someone ...