Questions tagged [date-parsing]

Date-parsing refers to programming logic which reads one or more parameters, attempts to match it to a supported or specified date format, then returns the resulting Date if successful.

References

494 questions
4
votes
1 answer

Pandas: FutureWarning: Use pd.to_datetime instead

I'm using Pandas to read a .xlsx file as follows: client_df = pd.read_excel( client_file, header = 1, parse_dates = ['Event Date'], date_parser = lambda x: datetime.strftime(x, '%Y-%m-%d') ) This works fine, but I'm…
Nando Machado
  • 182
  • 1
  • 11
4
votes
2 answers

dateutil parser for month/year strings

Somewhat related to this post: dateutil parser for month/year format: return beginning of month Given a date string of the form 'Sep-2020', dateutil.parser.parse correctly identifies the month and the year but adds the day as well. If a default is…
vkkodali
  • 630
  • 7
  • 18
4
votes
6 answers

Compare dates from a String in list

I'm having a problem continuing. I have a list and in each position contains a String (within the phrase there is at the end a date) Example: I am new here 20/8/2019 I want to sort the list this way: In position zero I want the phrase containing…
RM.
  • 59
  • 1
  • 7
4
votes
1 answer

Date parsing code for "Jul 07, 2019" in pandas, Python

I've been trying to parse the date of the form - Jul 07, 2018 to dd-mm-yyyy format for my financial time series project. But being new to Pandas, I am not able to do it the usual way i.e., using I've tried: dateparse = lambda dates:…
4
votes
2 answers

JQuery UI Datepicker parseDate 'Missing number at position 6'

I need to parse dates like '070126' to '26 Jan 2007'. I thought I could use the datepicker, but it gives me the an error... $.datepicker.parseDate('ymmdd', '070126') #=> Missing number at position 6 I am starting to think that this could be a…
Tom Maeckelberghe
  • 1,969
  • 3
  • 21
  • 24
4
votes
0 answers

moment.js - How to parse a date string string with a text timezone like 'PST'?

I have a date string from an API containing a timezone using abbreviations: "01/16/2018 12:15pm PST" Moment.js seems to ignore the timezone though, even if I use the z timezone input parsing string. That only seems to handle timezones strings that…
Andy Ray
  • 30,372
  • 14
  • 101
  • 138
4
votes
3 answers

Java - How to make JSON date validation?

I have this piece of code: @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd") protected Date statusDate; But for somehow it accepts date formats like - "statusDate": "2017-13-27" or "statusDate": "201823-12-12" Is it…
Dvir
  • 301
  • 1
  • 2
  • 16
4
votes
1 answer

How to Javascript validate End time and From time with date parse with AM/PM?

This is my script. $(document).on("click","input[name='to_time[]']",function(){ var from = $("input[name='from_time[]']").val(); // "11:15 AM" var to = $("input[name='to_time[]']").val(); //"10:15 AM" if(Date.parse(from) >…
Hardik Patil
  • 515
  • 1
  • 4
  • 16
4
votes
3 answers

LocalDate - parsing is case sensitive

public class Solution { public static void main(String[] args) { System.out.println(isDateOdd("MAY 1 2013")); } public static boolean isDateOdd(String date) { DateTimeFormatter formatter =…
Aldres
  • 185
  • 1
  • 3
  • 16
4
votes
1 answer

Dealing with month names in different languages

I have input with dates in many differing formats. I'm basically trying to take all the different formats and standardize them into ISO 8601 format. If the date contains a month name, e.g., March, then I'm using the following function to get the…
Franz Kafka
  • 780
  • 2
  • 13
  • 34
4
votes
2 answers

How to parse only 4 digit years

I'm using Joda-Time to parse years like this: private DateTime attemptParse(String pattern, String date) { DateTimeFormatter parser = DateTimeFormat.forPattern(pattern).withLocale(Locale.ENGLISH); DateTime parsedDateTime =…
micdcar
  • 181
  • 1
  • 11
4
votes
2 answers

DateTime Manipulation in C# vs Java

I'm new to Java. I have a time I am getting from a web-page, this is in the "hh:mm" format (not 24 hour). This comes to me as a string. I then want to combine this string with todays date in order to make a Java Date I can use. In C#: string s =…
MoonKnight
  • 23,214
  • 40
  • 145
  • 277
4
votes
1 answer

Is there an inverse function of DayOfWeek::getDisplayName()

I need a converter that converts DayOfWeek into String and the other way around given some Locale and TextStyle. One way is straight forward: public String getAsString(DayOfWeek day, TextStyle style, Locale locale){ return…
János
  • 153
  • 6
4
votes
1 answer

ParseExact - String was not recognized as a valid DateTime

I'm trying to convert string variable to datetime format: [DateTime]::ParseExact($tempdate, 'dd.MM.yyyy', [CultureInfo]::InvariantCulture).ToString('yyMMdd') $tempdate contains date in format dd.MM.yyyy which was obtained from an Excel…
John K.
  • 43
  • 1
  • 1
  • 3
4
votes
3 answers

SimpleDateFormat with pattern yyyyMMddhhmmss unable to parse date "20160327020727"

I am getting an exception when parsing date 20160327020727 with format yyyyMMddhhmmss. Note that the lenient is set to false. SimpleDateFormat df = new SimpleDateFormat("yyyyMMddhhmmss"); df.setLenient(false); try { Date dt =…
Amer Hukic
  • 1,494
  • 1
  • 19
  • 29