Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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: ...
A. Vreeswijk's user avatar
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: ...
craig's user avatar
  • 225
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: ...
singrium's user avatar
  • 327
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). ...
smci's user avatar
  • 383
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: ...
Dirk Boer's user avatar
  • 640
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 ...
Axle Max's user avatar
  • 151
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 ...
Raven Dreamer's user avatar
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 ...
user855443's user avatar
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 ...
simonalexander2005's user avatar
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 ...
avazula's user avatar
  • 334
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 ...
l0b0's user avatar
  • 8,977
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. ...
Hunter T.'s user avatar
  • 207
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 ...
ajc's user avatar
  • 141
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: ...
alecxe's user avatar
  • 17.3k
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 ...
jss367's user avatar
  • 476
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 ...
Dan's user avatar
  • 375
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 ...
Alexey Zabelin's user avatar
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 ...
JavaQueen's user avatar
  • 141
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) | ...
randyr's user avatar
  • 501
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 ...
ksiimson's user avatar
  • 173
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 ...
tumdum's user avatar
  • 83
6 votes
2 answers
897 views

Parsing Day Range with Time in Ruby

I need to shorten/simplify this code: ...
Aulison Dsilva's user avatar
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. ...
Quo kk's user avatar
  • 33
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 ...
buddyp450's user avatar
  • 139
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 ...
autrilla's user avatar
  • 133
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
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: ...
skiwi's user avatar
  • 10.6k
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 ...
Revious's user avatar
  • 503
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? ...
SOF User's user avatar
  • 139
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: ...
whereswalden's user avatar
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 ...
ten1267's user avatar
  • 41
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 ...
Scott's user avatar
  • 183