Questions tagged [date]
24586 questions
-1
votes
1
answer
39
Views
Excluding Sunday and Saturday in Javascript
My js project is working fine but I need to exclude Saturdays and Sunday in it, or even holiday. Can you please check on my code on how can I achieve this.
Meet me at
var m_names = ['January', 'February', 'March',
'April', 'May', 'June', 'July', 'August', 'September',
'October', 'November', 'Decemb...
-3
votes
1
answer
20
Views
Is there a way to get date of the object attached in the picture?
I am not able to console a property time in the attached image it gives error ;
link of the image . https://imgur.com/a/IevJFRw
i have tried the dot operator to access the property it gives undefined
const data = {
channel: null
message: 'hi deepak'
receiver: 3
sender: 4
time: {$date: 1555993671...
1
votes
3
answer
36
Views
How to loop two DateTime by minutes? JavaScript
var start = '13.04.2019 10:00:00';
var end = '14.04.2019 16:00:00';
I need to loop minute by minute. please help me.
// var start = '13.04.2019 10:00:00';
// var end = '14.04.2019 16:00:00';
var start = new Date(2019,05,13,11,00,00,00);
var end = new Date(2019,05,14,16,00,00,00);
var loop = start;
w...
1
votes
3
answer
91
Views
AS400 SQL Database Query
The time column has a string type containing a time in the format HHMMSS. Sample data is:
95030
122030
132030
As you can see, there are no leading zeros.
I am trying to extract the above values and convert them to something like below
95030 -> 9:50:30
122030 -> 12:20:30
The Sql Query:
select ca...
1
votes
2
answer
45
Views
Is there a built in way to get date in 6 digit format YYMMDD? [duplicate]
This question already has an answer here:
How to format a JavaScript date
49 answers
I'm trying to create a function the will create a list of dates formatted in a 6 digit number starting from today till August of 2018. the result should be something like this:
[190322, 190321, 190320, ...]
I'm no...
1
votes
4
answer
28
Views
Extracting dates that exist in another dataframe within each subject (R)
I have 2 dataframes, both with different dates:
Dataframe 1
ID Date
A 21/1/2018
A 22/1/2018
B 21/1/2018
B 26/2/2018
C 19/9/2019
Dataframe 2
ID Date
A 21/1/2018
A 22/1/2018
A 23/1/2018
B 21/1/2018
B 22/1/2018
B 23/1/2018
C 20/1/2018
C 04/5/2018
I want to e...
1
votes
2
answer
55
Views
parse file and date manipulation in bash with a large file
I'm looking for a better way to manipulate a date format into something that I want. I do manage to do it, but I have to process the files several times because I can not get date to do it in one pass.
The format I have:
Wed Jan 30 08:00:00 2019 : misc data
The format I want:
30/01/2019 08:00:00 : m...
1
votes
3
answer
63
Views
java.time.format.DateTimeParseException: Unable to obtain ZonedDateTime from TemporalAccessor on format ddMMyyyyhhmmss [duplicate]
This question already has an answer here:
Unable to obtain ZonedDateTime from TemporalAccessor when parsing a Date
2 answers
I'm having trouble in formatting a string to a ZonedDateTime.
My customer wants to have the date in a format such as ddMMyyyyhhmmss, with no separators or stuff like that....
1
votes
3
answer
36
Views
How to change the year of a date in a pandas dataframe given various conditions?
I have a dataset which looks like this:
ID Date
1 3 2016-04-01
2 3 2016-04-02
3 3 2016-04-03
4 3 2016-04-04
5 3 2016-04-05
6 3 2017-04-01
7 3 2017-04-02
8 3 2017-04-03
9 3 2017-04-04
10 3 2017-04-05
11 7 2016-04-01
12 7 2016-04-0...
1
votes
2
answer
50
Views
Oracle - How to repeat query for every year/month/week
I've made a query to get the rows from my chosen columns where the date is 2018 December:
SELECT myColumn1, myColumn2
FROM MyTable
WHERE to_char(myColumn_DATE, 'YYYY/MM') = '2018/12'
This is quite simple and I can now use these rows to create some further logic. However what if I need to repeat th...
1
votes
4
answer
96
Views
Date.getDate always return 1
For an unknown reason, getDate always return 1 instead of 28. I'm using NodeJS 10.6.0 and Typescript 3.2.2.
const lastDay = new Date();
lastDay.setDate(0);
lastDay.setHours(24, 59, 59, 999);
console.log(lastDay, '|', lastDay.getDate()); // 2019-02-28T23:59:59.999Z | 1
Edit: I'm trying to get the...
1
votes
1
answer
28
Views
Pandas: Select last dates from cut-off level
I have a list of dates and a cut-off level: 31st of March. I want to look at the first date before 31st of March and make that the last date in the year and then select the last 3 before and put them into 1 year. (E.g: If we look at 1997, the first date before March 1997, is: index 8, date: 1996-12-...
1
votes
2
answer
28
Views
Two identical dates in different formats give different epoch times
The following statement:
(new Date('1993-09-01')).getTime() == (new Date(1993,9,1)).getTime()
Seems to evaluate to false across both Node, Firefox and Chromium. Why does this happen?
1
votes
1
answer
61
Views
Swift - date formatter returns unwanted time
If I convert '2019-01-01T00:00:00+0000' to a date, I would like the date to be the date in the string - January 1, 2019. And if I calculate the number of seconds in the time portion, I would like the result to be zero.
The problem is, when I convert my string into a date, it is stored in the UTC ti...
0
votes
0
answer
13
Views
Proper way to manipulate date string with wrong year, but correct time
I'm having to hit an API I have no access to fixing and I need to start a timer showing how long someone has been in a queue for. The date I get back is in this format 1556214336.316. The problem is the year always shows up as 1970, but the time is the correct start time. I need to calculate the...
1
votes
3
answer
2.9k
Views
Can we pass value to annotations at runtime?
We need to create an annotation in java called DateFormat. It will take string dateformat eg.
class User
{
@Dateformat('MMM/dd/yyyy')
private Date birthDate;
}
Here the date format is statically passed as an argument to the annotation. Is there any way we can pass this date format at run time may...
1
votes
2
answer
11.2k
Views
Set date at QDateEdit with C++
I have this QDateEdit widget but it displays always a standard time like 01-01-2014 (in DD-MM-YYYY, but I can change this in the UI). But I want it to display the current time if the dialog (where this QDateEdit widget is) is opened.
I tested this just on a label (see the void form_dialog). But its...
1
votes
7
answer
64
Views
Array.filter is returning empty array
I am trying to get the failure Details based on Date.
For this I am applying array.filter but it is returning empty array.
Below is my array:
value:[{
'Date': '02/04/2019',
'Total': '1000',
'Success': '850',
'Failure': '150',
'FailureDeatils': [{
'Reason': 'Reason1',
'Count': 2
},
{
'Reason': 'Reaso...
3
votes
3
answer
32
Views
How to convert Date format to `2019-04-24T04:27:14.867Z`
I need to send a Date to my backend in the following format:
2019-04-24T04:27:14.867Z
I tried doing these:
var d = new Date();
console.log(d);
var utcDate1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5));
console.log(utcDate1);
var newFormat = new Date('04/21/19');
console.log(newFormat);
Nothing works. wha...
1
votes
2
answer
1.4k
Views
UTC string date to local date
Hi I got date from third party REST service in string like 2014-10-14 03:05:39 which is in UTC format. How to convert this date into local format?
1
votes
1
answer
468
Views
How to find Days difference between two dates using javascript
I need to find days difference between two dates using javascript, here is my code
I have start date and end date
var diff = Math.floor((Date.parse(enddate) - Date.parse(startdate)) / 86400000);
Its calculating the difference from current time. I need to find the number of dates between given dates...
1
votes
1
answer
414
Views
Can't use variable in DateTime's modify() function. I'm getting an error: Object of class DateInterval could not be converted to string
I managed to dynamically load and compare several time values in PHP.
Right now I am stuck here:
$additional_time = $entry_start->diff($compare_from_timeformat);
$additional_time ->format('H:i');
$avaliabletime->modify('+1 hours');
I want to replace the +1 with $avaliabletime but if i try something...
1
votes
1
answer
492
Views
Multiple language datetime text to standard date format [closed]
I'm using dateutil.parser.parse in Python to standardize dates. Not all of the dates are in English. Therefore, the standardization process failed with 'unknown string format' error. Is there a way to process such dates or at least avoid the error?
Sample date formats:
Wed, 17 Oct 2001 11:49:53 -070...
0
votes
1
answer
23
Views
modify existing date and result would be in same format with java
I have a Date which is coming like this Thu Dec 31 16:00:00 EST 1969.
So i just need to add one day in this so that i will get Thu Jan 01 16:00:00 EST 1970.
any idea with java ?
1
votes
1
answer
1.5k
Views
Why is Calendar.date(from: DateComponents) adding time?
I create an instance of DateComponents using the following code:
let dateComponents = DateComponents(
calendar: .current,
timeZone: Calendar.current.timeZone,
era: nil,
year: nil,
month: nil,
day: nil,
hour: 9,
minute: 0,
second: 0,
nanosecond: 0,
weekday: 2,
weekdayOrdinal: nil,
quarter: nil,
weekO...
1
votes
2
answer
5.3k
Views
Java to Mongo Document date
I am inserting a document by converting the pojo to document object using static parse method from Mongo driver.
Document newList = parse(gson.toJson(myPoJo));
collections.insertOne(newList);
This pojo has a Date attribute. But parse method will not adhere this type and convert it to string i think...
1
votes
2
answer
4.1k
Views
Converting timestamp to Calendar in Java [duplicate]
This question already has an answer here:
Convert Epoch seconds to date and time format in Java
5 answers
I want to get the year, month, date and hour from a long timestamp value. I found many examples of creating a Calendar from a timestamp value, but I don't get what I want.
I wrote the followin...
1
votes
2
answer
1.2k
Views
Parse date and change format from spanish
This might be a duplicated question but since I have read all
the comments about it and I don't solve my question I have to ask again.
I am working with a dataframe where I Have a column with this look:
print final['fecha_dato'][2]
31 de Enero del 2017
I do this in order to make it more understandab...
1
votes
1
answer
3.5k
Views
JavaScript - Convert dates and times (Chart.js and Moment.js)
If you have a better solution (perhaps a D3 solution for this problem): your answer will be appreciated!
I'm new to Chart.js and despite reading the docs of both Chart.js and Moment.js over and over again, I don't seem to possess the skills needed to create the chart I'd like to create.
That said, I...
1
votes
1
answer
9.3k
Views
Matplotlib dates in datetime format
I am plotting a candlestick chart (ohlc+volume) and unfortunately I can't figure out how to display the date in datetime format. Several approaches did not work.
import matplotlib.pyplot as plt
from matplotlib.finance import candlestick_ohlc
from matplotlib import style
import pandas as pd
style.use...
1
votes
2
answer
60
Views
Calendar give wrong day
I get from my GPS tracker a time String in UTC-Format like this: hhmmss.ssss.
I want to convert the UTC time to the local time of the user by using calendar. So I extract the hours, minutes and seconds from the time String via substring(int start, int end) and set it via the Calendar.set(int field,...
1
votes
3
answer
153
Views
PHP Time Comparison Is Failing
I'm working on a Wordpress plugin and having problems with a time comparison. I basically want: if selected time is before current time, do the thing... but it's not working.
The validation is failing if expire is less than five hours ahead of the time(). I correct this by adding the gmt offset expi...
1
votes
2
answer
74
Views
Last day of a month?
This example is a way to calculate the last day of a month using date library.
Is there a simpler solution to this goal?
this idea not work:
lastDay = firstDay + months{1} - days{1};
#include
#include
using namespace std;
using namespace date;
int main() {
sys_days firstDay, lastDay;
string d1;
d1...
1
votes
4
answer
110
Views
Java String to Date Convertion
I'm trying to convert a string to date
I tried in couple ways but i'm getting the same.Please could any one help me out.
String stringDate ='20181228184821';
Date date = null;
SimpleDateFormat sdf1 = new SimpleDateFormat('yyyyMMdd HH:mm:ss');
try {
date = sdf1.parse(stringDate);
System.out.println(...
1
votes
3
answer
62
Views
Show only To-dos with today's due-date in Android app
For my app I need a function that only shows the to-dos which due date is today. I am new to Android Studio and Java, so unfortunately I do not know how to write this code.
This is my code so far:
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getIdemid()) {
case R.id.menu_daily...
1
votes
3
answer
72
Views
When casting a timestamp to date yields a (Date + 1)
In Google Spanner, I am trying to cast some timestamps to date, when I found this issue.
When executing the script below:
SELECT EXTRACT(DATE FROM CAST('2019-01-01T07:56:34Z' AS TIMESTAMP))
I get an output 2018-12-31, rather than 2019-01-01.
How should I parse it to the exact date?
1
votes
1
answer
50
Views
Create quarterly dates vector for plot in Matlab
How can I transform this (much longer) vector into quarterly values like Q1-1991 etc. that plot nicely on a graph in Matlab? I googled/Matlab-help-searched/searched in this forum and didn't find anything.
Dates = [19961; 19962; 19963; 19964; 19971; 19972]
1
votes
3
answer
65
Views
SQL Date interval not working with AND clause
I am trying to count views in time interval. The request below works only without the AND clause
If I take out the AND s.timestamp < 2019-01-31 it works just fine.
SELECT s.category_id, c.name, count(s.category_id) AS ViewCount
FROM stat_product_category s
JOIN category c ON s.category_id = c.id...
1
votes
1
answer
30
Views
SQL Server : returning a cost based on a date range between 2 tables
I have 2 tables, one for transactions of inventory and one for standard cost history. I am trying to get the standard from the cost table by using the dates to determine what standard to select between the 2 tables.
So as an example:
ProductID Trans.Date
-----------------------
P001 12/26/...
1
votes
1
answer
67
Views
How can I subtract two row's within same column in same date?
I have a query. I want to do an subtraction of the first and last row in the same day. I wrote the this query, but I was not sure of the performance. Is there an alternative way to this problem?
| imei | date | km |
|-----------------------------------------|
| 123 | 2019-01...