date

How to perform date comparisons against postgres with sequelize

爱⌒轻易说出口 提交于 2021-01-29 18:51:16
问题 I want to delete all records with dates before 20 minutes ago. Postgres (or Sequelize) is not satisfied with the bare javascript Date object I provide as the comparison value. I'm using sequelize 4.37 on top of a postgres 9.6 database. The column in question was declared with type: Sequelize.DATE , which research suggests is equivalent to TIMESTAMP WITH TIME ZONE : a full date and time with microsecond precision and a timezone signifier. (That is also what I see when I use the psql CLI tool

Dates in Safari appear off by one using Intl.DateTimeFormat with en-US locale

大憨熊 提交于 2021-01-29 17:52:25
问题 It looks like Safari's implementation of Int.DateTimeFormat assumes that the second Sunday in March will ALWAYS be the DST time cutoff which is not correct as prior to 2007 it was the first Sunday in April. It also appears that this affects the other end as well when DST ends. PS: This code is being run in Indiana, USA which is in the eastern time zone (GMT-4) More specifically... 2007 and newer: correctly for all dates. 2006: incorrectly for dates between the second Sunday in March and first

Why does strptime from datetime not give me the correct hours?

*爱你&永不变心* 提交于 2021-01-29 16:43:07
问题 I am dealing with hourly data in which the date is stored in 4 different arrays, one for day, month, year, and hour. I am running a for-loop to rather store these dates as strings with this format: '01/01/1946 0' My code looks something like this: import numpy as np from datetime import datetime as dt import matplotlib.dates as mdates for nn in range(nnn): y1 = int(yr[nn]) m1 = int(mon[nn]) d1 = int(day[nn]) h1 = int(hr[nn]) #In the the last string we are specifying the format datenow = dt

How to change Date String Format (20th Oct 2052 -> 2052-10-20)

孤者浪人 提交于 2021-01-29 16:15:56
问题 Blockquote I have a date string in the format Day Month Year, like 1st Mar 1984, 4th Apr 1973, 22nd May 2006, where: Day is in the set {"1st","2nd","3rd",...,'"30th","31st"} Month is in the set {"Jan","Feb","Mar",...,"Dec"} Year is in the range [1900,2100] I gotta convert the date string to the format YYYY-MM-DD, like: 1st Mar 1984 -> 1984-03-01 4th Apr 1973 -> 1973-04-04 (The function reformatDate has the following parameters: dates[dates[0],...,dates[n-1]] is an array of date strings in the

SQL help - exception report

烈酒焚心 提交于 2021-01-29 16:02:17
问题 I have a company table (CompanyID, CompanyName), Date Table (Datekey int, date, isTradingHoliday 0/1), Fact table (id, datekey, companyID, StockClosePrice) I need an exception report. Expectation is for all the companies, for all trading days, there will be a StockClosePrice. I need to find for which date and for which companies on the trading days I don't have data. So basically, I need help to write a query to find for year 2019 for which days and for which companies I don't have data in

python os.path.getctime max does not return latest

旧城冷巷雨未停 提交于 2021-01-29 15:46:23
问题 I have two files, one clearly more recent then the other, however max function when sorting by os.path.getctime does not return the most recent file. $ ls -lpat /foo.tar.gz -rw-r--r-- 1 appsc appsc 29653389 May 21 15:05 /foo.tar.gz $ ls -lpat /bar.tar.gz -rw-r--r-- 1 appsc appsc 29653554 May 27 17:30 /bar.tar.gz $ date Wed Jun 4 01:23:29 UTC 2014 $ python3 Python 3.3.2 (default, Nov 6 2013, 12:16:42) [GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux Type "help", "copyright", "credits" or

Date conversion in SAS (String to Date)

混江龙づ霸主 提交于 2021-01-29 13:45:31
问题 I import an Excel-spreadsheet using the following SAS-procedure. %let datafile = 'Excel.xlsx' %let tablename = myDB proc import datafile = &datafile out = &tablename dbms = xlsx replace ; run; One of the variables ( date_variable ) has the format DD.MM.YYYY. Therefore, I was defining a new format like this: data &tablename; set &tablename; format date_variable mmddyy10.; run; Now, I would like to sort the table by that variable: proc sort data = &tablename; by date_variable; run; However, as

cs-Cz locale and JavaScript new Date Constructor doesn't allow for shorthand date

喜你入骨 提交于 2021-01-29 12:38:21
问题 So I'm trying to follow the docs here on MDN regarding the date options for formatting https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat For the cs-cz locale, I want the month to be in "short" hand form when writing a date such as 19. 12. 2012 instead of 19. pro 201 This code works for locales such as en-us or it-it (italy) and others. var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0, 200)); var options = { month: 'short', day: 'numeric',

How to calculate difference between two date from DatePicker widget

女生的网名这么多〃 提交于 2021-01-29 10:33:49
问题 I've a problem with my GWT project: i'm only interested to calculate the difference between two date (in days) from two DatePicker Widget. This is my code, i take it mainly from here: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/datepicker/client/DatePicker.html // Create a date picker "FROM: " final DatePicker datePicker1 = new DatePicker(); datePicker1.addValueChangeHandler(new ValueChangeHandler<Date>() { public void onValueChange(ValueChangeEvent<Date> event) { Date date1

How to localise date format automatically in Java 8 [duplicate]

感情迁移 提交于 2021-01-29 10:33:40
问题 This question already has an answer here : Force 4-digit-year in localized strings generated from `DateTimeFormatter.ofLocalized…` in java.time (1 answer) Closed 2 years ago . I've been looking at the Date and Time library in Java 8 and was wondering if there is a way to format the date to the local format regardless of where the program is being run (as in, using the local format of the region the computer is set to). The Date and Time library uses the LocalDate class for getting a date.