Posts

Showing posts with the label date

Date format: Invalid Month

Date format: Invalid Month I have below data format 10/29/2003 10/21/2003 7:26:00 AM in a table and I want to compare dates in between '07-14-2013' and '09-15-2013'. I have written code as to_char(to_date(a.TEXT_VALUE, 'DD-MM-YYYY HH:MI:SS AM'),'dd-mm-YYYY') between '07-14-2013 00:00:00 AM' and '09-15-2013 00:00:00 AM' this is not working. Can anyone suggest what should I do to get dates between these 2 dates? How varied are the values in your text field? Do you have a mix of just dates, dates with times in 12-hour format (with AM/PM), and dates with times in 24-hour format? How sure are you that all the dates are in the same MM/DD/YYYY format? This is why dates should never be stored in varchar2 columns, but always in date columns. – Alex Poole Oct 16 '13 at 16:10 varchar2 date ...

Add a Java 8 ISO 8601 time duration expression to java.util.Date

Add a Java 8 ISO 8601 time duration expression to java.util.Date I have an expression like "PT20.345S" , "P2DT3H4M" etc as described here https://docs.oracle.com/javase/8/docs/api/java/time/Duration.html#parse-java.lang.CharSequence- "PT20.345S" "P2DT3H4M" How can I parse this, add it to the current time and get a java.util.Date object? java.util.Date Neither works: Date d1 = Date.from(LocalDateTime.now().plus(Duration.parse(_expression))); Date d2 = Date.from(Duration.parse(_expression).addTo(LocalDateTime.now())); FYI: (A) Try to avoid the java.util.Date class. Supplanted entirely by the java.time.Instant class years ago. (B) Never use LocalDateTime when you mean an actual moment, a specific point on the timeline. Use Instant , ZonedDateTime , or OffsetDateTime . – Basil Bourque Jun 30 at 23:50 ...

NameError: name 'Date' is not defined

NameError: name 'Date' is not defined I am trying the code below from the tutorial in youtube: https://www.youtube.com/watch?v=83-_3x2AjXI&t=3s I'm getting stuck on the following line plt.plot_date(date, closep,'-', label='Price') When running the script I'm getting the error message "NameError: name 'Date' is not defined" import matplotlib.pyplot as plt import numpy as np import urllib import matplotlib.dates as mdates #date converter/date processing def bytesdate2num(fmt, encoding='uftf-8'): strconverter = mdates.strdate2num(fmt) def bytesconverter(b): s = b.decode(encoding) return strconverter(s) return bytesconverter def graph_data(stock): stock_price_url = 'https://pythonprogramming.net/yahoo_finance_replacement' #dash dash plus stock plus dash dash source_code = urllib.request.urlopen(stock_price_url).read().decode() #add decode anytime python 'reads...

Regex for extracting all complex dates formats from a string in python

Regex for extracting all complex dates formats from a string in python I have following string: dateEntries = "04-20-2009; 04/20/09; 4/20/09; 4/3/09; Mar 20, 2009; March 20, 2009; Mar. 20, 2009; Mar 20 2009; 20 Mar 2009; 20 March 2009; 2 Mar. 2009; 20 March, 2009; Mar 20th, 2009; Mar 21st, 2009; Mar 22nd, 2009; Feb 2009; Sep 2009; Oct 2010; 6/2008; 12/2009; 2009; 2010" Here I want to extract all mentioned dates using regex . As an attempt I have written following regex : regex regex import re regEx = r'(?:d{1,2}[-/th|st|nd|rds]*)?(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[a-zs,.]*(?:d{1,2}[-/th|st|nd|rd)s,]*)?(?:d{2,4})' re.findall(regEx, dateEntries) I was expecting this to work but it only return subset of dates. A = ['Mar 20, 2009', 'March 20, 2009', 'Mar. 20, 2009', 'Mar 20 2009', '20 Mar 2009', '20 March 2009', '2 Mar. 2009', '20 March, 2009', 'Mar 20th, 2009', 'Mar 21s...