Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 days ago.
This post was edited and submitted for review 4 days ago.
Improve this question
I need a way to pick a date in flutter in the following order, year then month then day.
Initially I want to allow user to select only years and then in same way months and in same way only allow to select date.
The code I've tried
await showDatePicker(
context: context,
initialDate: DateTime.now(), //get today's date
firstDate:DateTime(2000), //DateTime.now() - not to allow to choose before today.
lastDate: DateTime(2101)
)
But I don't know what I want to specify more for the way I want.
Your help will be appreciated.
You just need to add 1 line into your showDatePicker
showDatePicker(
context: context,
initialDate: selectedDate,
firstDate: DateTime(2000),
lastDate: DateTime(2030),
initialDatePickerMode: DatePickerMode.year,
)
Or if you want to use with more features then you can use Syncfusion_flutter_datepicker package
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 months ago.
This post was edited and submitted for review 3 months ago and failed to reopen the post:
Needs details or clarity Add details and clarify the problem by editing this post.
Improve this question
(hour(date_column ) * 4)
+ ifn(minute(date_column ) = 0, 0
, ifn(minute(date_column ) <= 15, 1
, ifn(minute(date_column ) <= 30, 2
, ifn(minute(date_column ) <= 45, 3, 4))))
as date_no
What are the equivalents of these functions in PostgreSQL?
I am trying to extract value based on 15 mins interval in an hour.
It would help if you explained your goal and current logic in a bit more detail, but for now it looks like this would suffice:
select extract('hours' from date_column) * 4
+ ceil(extract('minutes' from date_column) / 15) as date_no
from your_table;
extract() is used in PostgreSQL for the same thing hour() and minute() are in SAS.
You can use CASE the exact same way you would in SAS but there's no IFN() counterpart.
CEIL() works the same in both, so you could also shorten your SAS version replacing all the IFN's.
You're effectively binning date/times, so you could look into date_bin(). Similar effect can probably be achieved in SAS through the use of INTNX() or plain ROUND() (1, 2).
Demo
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
How to convert '02-3月 -21' to date 21-03-02 00:00:00? in postgresql or kettle
I think a simple replace can do the trick here. Just replace the Chinese character 月 with nothing and format it.
SELECT TO_TIMESTAMP(REPLACE ('02-3月-21', '月', ''),'DD-MM-YY');
// output: 2021-03-02 00:00:00+00
SELECT TO_CHAR(TO_TIMESTAMP(REPLACE ('02-3月-21', '月', ''),'DD-MM-YY'), 'YY-MM-DD HH24:MI:SS')
// output: 21-03-02 00:00:00
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
how would I go about selecting data from only Sundays in 2019 in Postgres?
I think Sundays are a 0 but I am unsure as to how to query it like that.
I am selecting from a preexisting table that contains timestamp strings like 2020-09-03 02:11:60, so basically I want to select all the timestamps that occurred in 2019 in my table usermetrics in the column timestamp.
You have two requests.
The first to find timestamps in 2019:
SELECT
*
FROM
usermetrics
WHERE
timestamp BETWEEN '01/01/2019'::date AND '01/01/2020'::date
The second to find those that occurred on Sundays:
SELECT
*
FROM
usermetrics
WHERE
timestamp BETWEEN '01/01/2019'::date AND '01/01/2020'::date
AND
extract(DOW FROM timestamp) = 0;
01/01/2020::date is used as 12/31/2019::date would miss timestamps that occurred after midnight.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a date1 and the current Date when the view did load.
Now I want to display how many days have passed since the day.
let timeInterval = date1.timeIntervalSince(date2)
Now I want to convert the timeInterval in days.
Anyone could help?
Rather than using TimeInterval you can get the number of days directly by using the Calendar class and DateComponents
let days = Calendar.current.dateComponents([.day], from: date1, to: date2)
print(days.day!)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
My date dimension table has a column "date_id" which has dates from 2016-01-01 till 2025-01-01. I wanted to create a view on the top of this date table and introduce an extra column say "date_id_365". The new column should have ALL the last 365 dates for each date_id.
Like for example If I pick a date_id to say 2020-01-15, that date_id should return dates from 2019-01-15 till 2020-01-15.
How to write the SQL in snowflake for this?
I think maybe you're looking for something like this...which is pretty standard SQL, not specifically for Snowflake. This assumes that date_id is a DATE field, which I'm not seeing in your comments, but you could convert it or use the date field.
SELECT a.date_id, b.date_id as date_id_365
FROM dim_date a
JOIN dim_date b
ON b.date_id BETWEEN DATEADD(year,-1,a.date_id) AND a.date_id
I haven't tested this myself, but pretty sure this will work for you. The only issue will be with your dates for the year 2016, since it won't have any dates in 2015 to join back to.