Questions tagged [datetime]

In numerous programming languages, a DateTime object serves to represent both a specific date and time. Its versatile nature allows it to convey either an exact moment or a calendar-based position, depending on the given context and implementation. Utilize this tag extensively for any inquiries pertaining to dates and times.

Ways to easily add one year to the current year if the date has already occurred

$mpsAgeT = $today->diff($mpsAgeT); Assuming $today is: object(DateTime)[37] public 'date' => string '2019-06-17 13:40:56.888563' (length=26) public 'timezone_type' => int 3 public 'timezone' => string 'Europe/Sofia' (length=12) and the ...

Converting milliseconds into a formatted DateTime using AngularJS: A step-by-step guide

Upon receiving JSON data from the server, I obtained a date-time in milliseconds: $scope.JDT = "1492499995056";. While I am able to display the scope variable 'JDT' on my view using a filter: {{JDT | date:"dd/MM/yyyy h:mm:ss a"}} ... I do not actually ne ...

Troubleshooting problem with sorting dates in MVC jQuery datatable

I have successfully implemented a datatable in MVC3 using c#. Everything was working perfectly on my local development machine, including the sorting of DateTime columns. However, when I uploaded the code to the server and accessed the webpage, I encounte ...

Determining the semester of a day using pandas.Period: A step-by-step guide

Is there an easy way to determine which semester a given day belongs to and display it in the format 'YYYY-SX'? For example, turning 2018-01-01 into (2018S1). While it's simple to do this for quarters with a date range using pandas: import ...

Jquery Time Picker for AM PM Selection

I have experience using the Jquery date picker (jsfiddle), but now I am interested in creating an AM/PM picker using Jquery. My goal is to have a button that, when clicked, displays the time with the format (12:56:AM) or (01:12:PM). Can anyone provide gu ...

Filtering pandas dataframe to only show rows from certain months

I am dealing with a pandas dataframe that includes a date column spanning from 2015 to 2021. print(data) date time wind_speed wind_direction 0 2015-01-01 00:00 00:00 28.0 25.0 1 2015-01-01 01:00 01:00 ...

Instructions on assigning a date string value (retrieved from the database) to the <input type="date" ng-model="endtime" name="endtime" /> field

Hey there! I'm new to using angularjs and I'm facing some issues. I have a list of data where, when updating a row, the row value should be added to a table with a datetime column. However, when I try to edit it, I can't seem to set the value to the date p ...

Looking for a reliable date and time picker for Material-UI version 5 in ReactJS. Can anyone recommend one?

I am looking to integrate a datetime picker into my ReactJS app that is based on Material-UI V5. After consulting the documentation, I found the recommendation to install @mui/x-date-pickers However, when attempting to do so, an error occurs: node@62 ...

Why is the MySQL datetime showing a 2-hour discrepancy?

I'm facing a peculiar issue that is leaving me puzzled... I have a PHP file that generates the following output: date('Y-m-d H:i:s', time()) Interestingly, this code snippet produces the correct datetime. However, when I attempt to store th ...

Is there a way to retrieve a time period before the current date in PHP?

My objective is to retrieve a series of dates starting from today "2011-11-24" and going back 7 days: The resulting values should be: "2011-11-23", "2011-11-22", "2011-11-21", "2011-11-20", "2011-11-19", "2011-11-18", "2011-11-17" ...

Establishing the state using the data from a React date and time component

Help needed! I'm encountering an issue with a reactDateTime component. I am struggling to retrieve the selected date value and store it in a state along with other form field attributes. Below is my code snippet: Datetime Component <Datetime onCh ...

In PHP and MySQL, the GROUP BY clause does not function properly with datetime data types

I have a variety of datetimes stored in my MySQL database, listed as follows: 2016-11-15 10:00:00 2016-11-16 10:00:00 2016-11-17 10:00:00 2016-11-17 12:00:00 2016-11-17 19:30:00 2016-11-20 10:00:00 2016-12-15 10:00:00 2017-11-15 10:22:00 I need to displa ...

Using AngularJS date picker to set value in Spring model setter

When using AngularJS with Spring, I noticed a discrepancy in the date values between my view file and the POJO User object. In my view file, I have used an input type date to bind the "user.dateOfBirth" attribute. When I select a date, it is displayed cor ...

Dealing with date formatting can be a headache when it comes to different

For my project, I have incorporated angularJS and momentJS to handle the date formatting more efficiently. I am facing two specific scenarios: Retrieving dates from a database and displaying them in the user interface: The response I receive from the s ...

Combining two objects in node-red: A step-by-step guide

msg.payload : Object object HAMK307: object a_temperature: 23.1 a_humidity: 46 a_brightness: 3703.05 a_lights: "on" a_presence: "empty" r_temperature: 35.59 r_humidity: 30.46 r_pressure: 994.43 a_time: object ID: "HAMK-307" m ...

Extracting Day and Time from Python Datetime

I need to extract the day and time from a datetime index of a dataframe. Here's what I have: df.index = DatetimeIndex(['2020-07-07 19:03:38', '2020-07-08 18:50:40', '2020-07-24 4:20:13', '2020-07-25 ...

What is the best method for sorting data in pandas by time values?

Recently diving into Python, I am currently utilizing the pandas package to analyze workload patterns. In my dataframe, there are two columns representing the start and end times of work. My objective is to filter rows in the dataframe that fall between sp ...

Transforming dates in the pandas data structure layout

After opening my data in .csv format using pandas, I am looking to change the date format from dd/mm/YYYY hh:mm:ss to simply YYYY-mm-dd. For example, from 19/11/2014 15:26:13 to 2014-11-19. How can I accomplish this transformation within a pandas data arra ...

Angular2 calendar and time selector

Having trouble setting up a date and time picker for my angular2 app. Can anyone provide assistance with this? I've experimented with the following methods: Ng2-datetime: I added it to the main app.module file: import { NKDatetimeModule } from 'ng2-dat ...

Pandas exhibits inconsistent behavior when rounding to the nearest hour

When using pandas to round a datetime to the nearest hour, there seems to be inconsistent rounding from the halfway point. Odd hours like 5 have their half-hour (5:30) rounded up, while even hours have their half-hour rounded down. For example, both 5:30 a ...

Struggling to modify the datetimepicker material-ui within a react js class component

I am currently using a datetimepicker component from material-ui/pickers in a class-based react-js component. I am facing an issue where the datetimepicker closes immediately every time I click on any part of it (date, year, etc.). Here's a snippet of the ...

Tips for using Carbon to calculate the duration of the weekends in hours?

I've been trying to utilize Carbon's weekend related functions, but they don't seem to be working as expected for me. My goal is to determine the duration of the weekend in hours and minutes. For instance, considering that the weekend starts after 12:00 ...

Using PHP's DateTime class, you can easily create a new DateTime object by specifying the date

I am currently utilizing PHP 7.2 for my project and attempting to generate a date from a string through the following process: $dateString = '2018-12-31T01:01:01+00:00'; $converted = DateTime::createFromFormat(DATE_ATOM), $dateString); The co ...

Conceal the year, month, and day within a datetime-local input

I am working with <input type="datetime-local" step="1"/> input fields, and I want users to only be able to edit the hours, minutes, or seconds. This is due to setting the minimum value using let min = new Date().setHours(0,0,0) and the maximum value ...

Does the DateTime class in PHP create issues within Laravel 5.1?

After implementing this code in my Laravel 5.1 project's controller: $start_date = "2015-06-10"; $date = new DateTime($start_date); I encountered a persistent issue when running the code on both Chrome and Firefox. My website would become unresponsive at ...

Tips on converting datetime to a specific time

I'm having trouble adjusting the time in a specific given timedate. For example: Timelimit is set to 10:30:00 $date = date('Y-m-d H:i:s'); if(date("Hi") < $timelimit)// CHECKS IF TIME IS RIGHT TO USE SCRIPT { $date = date('Y-m- ...

Converting timezones with Angular's datetime binding

My application receives a datetime from a JSON object via a REST service in the following format: 2014-03-30T08:00:00 When I bind this datetime and pass it through a date filter, it appears to be converted into local time. {{ mytime.begin | date:'dd-MM ...

"Enhance your web application with Material UI's powerful dat

Hey there, I've got a couple of questions about the Material UI - datagrid filter with type:dateTime. Is there a way to change the local format when selecting the date in the filter? It currently displays the AM/PM date format and I can't seem to find a w ...

AngularJS Date Picker is a powerful tool for selecting

<div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 mb-2"> <mat-form-field class="example-full-width" appearance="outline"> <mat-label>Follow up Consultation</mat-label> <input ...

Retrieve data from MySQL using a count query and convert the results into a JSON format

In my table, there is a column with datetimes and corresponding IDs. +----+---------------------+ | id | datetime | +----+---------------------+ | 0 | 2016-09-02 12:13:13 | | 1 | 2016-09-02 10:16:11 | | 2 | 2016-09-05 11:03:23 | | 3 | 2016- ...

PHP DateTime difference format returns negative zero

I created a function that checks if the difference between the current date and another date is less than x days. Below is the code for my function : private function notBeforeDate($date_to_check, $interval) { $now = new DateTime('now'); ...

datetime displaying in an alternate format than the true value

I am attempting to reformat a datetime pattern within CSV files: Original date format: DAY/MONTH/YEAR Desired Outcome: YEAR/MONTH/DAY rows = df['clock_now'] contains the following data: 22/05/2022 12:16 22/05/2022 12:20 22/05/2022 12:21 22/05/2022 12:44 ...

What is the best way to deduct 24 hours from a date time object in PHP?

Here is the code that I am currently using: $now = date("Y-m-d H:m:s"); $date = date("Y-m-d H:m:s", strtotime('-24 hours', $now)); Unfortunately, I am encountering this error: A non well formed numeric value encountered in... Can anyone help ...

How do I transform the date "Tue Nov 26 2019 16:00:00 GMT-0800" into the .NET JSON date format "/Date(1574812800000)/"?

I am looking to convert a date from ISO format to .NET JSON date format using JavaScript. For example, I want to change "Tue Nov 26 2019 16:00:00 GMT-0800" to "/Date(1574812800000)/". ...

Locate the nearest date (using JavaScript)

Searching for the nearest date from an XML file. <?xml version="1.0" encoding="UTF-8"?> <schedule> <layout fromdt="2014-01-01 00:00:00" todt="2014-01-01 05:30:00"/> <layout fromdt="2014-02-01 00:00:00" todt="2014-01-01 05 ...

Issue with child rows not functioning properly in DataTables when utilizing Datetime-moment

I've successfully integrated this data into live.datatables.net and almost have it running smoothly. However, I am encountering an issue with displaying the last detail as a child element. The final part of the row should be shown with the label "Message ...

Is there a way to sum/subtract an integer column by Business Days from a datetime column?

Here is a sample of my data frame: ID Number of Days Off First Day Off A01 3 16/03/2021 B01 10 24/03/2021 C02 3 31/03/2021 D03 2 02/04/2021 I am looking for a way to calculate the "First Day Back from Time Off" column. I attempted to use it ...

Use SQLite3 in Python to remove rows that match the specific date and time in the format yyyy/mm/dd hh:mm:ss

I have a large SQLITE3 database with the following structure: https://i.stack.imgur.com/G9GQX.jpg The "date_" field in the database is formatted as YYYY/MM/DD HH:MM:SS I am looking to remove all rows before the year 2020. I attempted to achieve this by ...

Transforming the current date() into a distinctive format, encompassing the utilization of T

Background In my Angular UI, I have a datepicker that is defined as: <date-picker name="contractEndDate" date="employee.contractEndDate"></date-picker> When the button is clicked, the contractEndDate value changes from null to the current da ...

Creating a weekly year pivot table in pandas

I'm a beginner with pandas and I need to create pivot tables for each week using data from a csv file that contains records spanning multiple years. I am having trouble figuring out the best way to filter the dataframe by week. Currently, I am doing ...

What is the best way to calculate the variance between the most recent and previous data points in an array in the span of an hour using JavaScript

Here is an array of objects I am working with: 0: {time: '2021-12-02T23:53:54.062Z', value: 558316} 1: {time: '2021-12-03T00:53:53.959Z', value: 558452} 2: {time: '2021-12-03T01:53:53.934Z', value: 558588} 3: {time: '2021-12-05T23:53:48.617Z', value: 56803 ...

Using FullCalendar with Django

Looking to incorporate the fullcalendar jQuery plugin into my Django project, specifically with an Entry model. class Entry(models.Model): date = models.DatetimeField() The Entry model only includes a date attribute. I understand that fullcalendar re ...

Time Record

I could use some guidance with this part. I am attempting to solve this using an array. There are 8 different areas that need to be updated based on the timestamp. Each area has an ID ranging from TS1 to TS8. My goal is to update all areas whenever the tim ...

PHP DateTime prior to year 0 (Ancient ACN date records)

Searching through stackoverflow for ACN dates yielded results only for dates after 0, between 0 and 1000, or between 0 and 1970. I am faced with the challenge of handling birthdates for individuals born before Year 0. Unfortunately, \juliantojd and & ...

Ionic datetime returns default values upon initialization

I'm currently in the process of developing an Ionic-Angular-app. I require a datetime component on a page to set the creation date of an object. I am using formGroup for this purpose, but whenever I choose a different date, it always reverts back to the in ...

Filtering another dataframe based on a specified range of hours

I need to filter my dataset based on 3-hour intervals, starting at 0000hr, 0300hr, 0600hr, and so on. An example of the dataset: Time A 2019-05-25 03:54:00 1 2019-05-25 03:57:00 2 2019-05-25 04:00:00 3 ... 2020-05-25 03:54:00 ...

PHP - Custom Date Format with a Text String

Seeking assistance with PHP date formatting for the following format: Wednesday 3rd November 2021 at 11:01am My current code snippet is as follows: $date = new DateTime($dateOfChange); $date = $date->format('l jS F Y "at" g:ia&apo ...

Filtering rows by the time difference between two datetime64 columns

I have a dataset that has the following structure trip_id start_date start_station_id end_date end_station_id subscription_type journey_duration weekday 0 913460 2019-08-31 23:26:00 50 2019-08-31 23:39:00 70 Subscriber 0 days ...

Sending Time and Date information from JSON to WCF POST

I have a class structure similar to the following: public class BudgetTransactionRequest { [DataMember] public string transaction_code { get; set; } [DataMember] public double? amount { get; set; } public Dat ...

The combination of Mysql's unix_timestamp function with date_add is producing inaccurate timestamps

I am experiencing an issue where I cannot get the correct unix_timestamp after using date_add on my database field. Instead of getting the unix_timestamp after the date_add, it is returning the unix_timestamp of the original value. Below is the query I am ...

Python code: Attempting to retrieve the hour, minute, and second values from a datetime object

As a newcomer to the Python environment, I am working on manipulating datetime objects by using the method replace(hour=...,minute=...,second=...) in an iterative manner and storing the results at each step in a pd.Series. The objective is to have a pd.Ser ...

Generating a JSON form to enable users to search for specific dates within a given range by utilizing the "datetime" data type

Currently, I am in the process of developing a form that can search for specific data within a JSON's datetime value. The objective is to retrieve information from the JSON that falls between the first and last dates entered by the user. However, despite m ...

Guide on converting HTML datetime picker datetime-local to moment format

I am looking to convert an input type : <input type="datetime-local" name="sdTime" id="stTimeID" onChange={this.stDateTime} /> into a specific date format: const dateFormat = 'MM/DD/YYYY hh:mm:ss a'; To achieve this, I need to transfer ...

php 7.4 guidelines on anticipating the date format "ddmmYYYY"

I'm looking for a way to ensure that users input dates in the format "ddmmYYYY", for example: 14012022. The issue I'm encountering is that I can't enforce this format using just: DateTime::createFromFormat('dmY', '14012022'); For instance, DateTime::crea ...

Is it possible to utilize a yyyy-mm-w format when plotting datetime data?

I am currently working with a dataset that is recorded on a weekly basis and I want to create a matplotlib plot using this information. The date format I am using is yyyymmw, where w represents the week of the month (ranging from 1 to 5). Each week starts ...

When comparing timestamps for the same date, Python's datetime and pandas may produce varying results

from datetime import datetime import pandas as pd date="2020-02-07T16:05:16.000000000" #Using datetime to convert date format t1=datetime.strptime(date[:-3],'%Y-%m-%dT%H:%M:%S.%f') #Converting date using Pandas t2=pd.to_datetime(date) #Calcul ...

Tips for transferring TimeZone Name from Angular to .NET API

Currently, the API I am working with accepts TimeZone names (such as America/Denver) as a string. In my Angular UI application, I automatically pass the browser timeZoneName to the API. However, when the API receives the string America/Denver, it interpret ...

Coordinated Universal Time on the Website

I am currently developing a website that will be exclusively accessible through the intranet, but it targets users across Australia. Recently, I have been instructed to explore the idea of incorporating UTC time on the site. I am contemplating how I can i ...

Converting a whole number into a timestamp using Python

After struggling with converting the list l: l = [0, 1] into timestamps corresponding to the indexes of dataframe df: dt val 2017-11-13 00:00:00 8 2017-11-13 01:00:00 17 Ideally, I want the result to be: l = [2017-11-13 00:00:00, 2 ...

Transform JSON time data from Coordinated Universal Time (UTC) to Indian Standard

Hello, I consider myself an amateur in the world of online javascript learning. Currently, I have come across a challenge that has left me stuck. I am working with a JSON time data provided in UTC format (e.g. 16:00:00Z) and my goal is to convert it to IS ...

Python code to verify if a specific condition is satisfied within a certain time period

Seeking to determine if certain conditions are met over a period of time. The data is structured as follows: Datetime Valve1 Valve2 01/01/2020 11:00:01 1 0 The condition being evaluated is: (Valve1=1 for 1h) and (Valve-0 for 1h) Utilizing rolling ...

Displaying a date and time beautifully in jQuery/JavaScript by providing the day of the week along with the specific time

Does anyone know of a Javascript library, preferably a jQuery plugin, that can take datetimes in any standard format (such as ISO 8601) and convert them into user-friendly strings like: Wednesday, 5:00pm Tomorrow, 9:00am Saturday, 11:00pm I'm not c ...

I am encountering zeros and negative values when working with Python and Pandas on a CSV file

Can the pandas library be used to replace negative days with zeroes or thirty days in a csv file? Below is an example: import datetime from dateutil.relativedelta import relativedelta import pandas as pd import numpy as np df = pd.read_csv("csv_data ...

Unable to display the last rendering time in AngularJS

I have made some modifications to my program in order to display the last time, but I am facing issues with it. Here is the code snippet: <h1> Time is {{date | date: "medium" }} </h1> $scope.date = function(){ Date.now(); } Unfor ...

Matplotlib has a tendency to add zeroes after the seconds when plotting time

My current plot can be seen below: https://i.stack.imgur.com/MFxai.png When I import 'time' strings like 08:12:46, I want to remove the ending zeros. However, I'm having trouble figuring out the solution. Additionally, is there a way to di ...

Pass the DateTime object from ASP.NET to angularjs as a structured data type instead of converting it to a

I'm encountering an issue where I am sending a complex object from my ASP.NET backend to the AngularJS frontend. This object includes a DateTime property and a list of objects, each with their own DateTime property. These properties are all sent as strings ...

Angular: displaying dates in a specific format while disregarding time zones

Is there a way to format date-time in Angular using DatePipe.format() without converting timezones, regardless of location? For instance, for various examples worldwide (ignoring time differences) I would like to obtain 07/06/2022: console.log('2022-07-06T ...

Are there any solutions for the malfunctioning v8 date parser?

The V8 Date parsing functionality is not functioning properly: > new Date('asd qw 101') Sat Jan 01 101 00:00:00 GMT+0100 (CET) I have attempted to use a delicate regular expression like the following: \d{1,2} (jan|feb|mar|may|jun|jul|a ...

Firestore TimeStamp.fromDate is not based on UTC timing

Does anyone have a solution for persisting UTC Timestamps in Firestore? In my Angular application, when I convert today's date to a Timestamp using the code below, it stores as UTC+2 (due to summer time in Switzerland). import {firebase} from ' ...

A step-by-step guide on increasing native Time variables in JavaScript

How can I dynamically and repetitively add time (both hours and minutes) in JavaScript to effectively increment a date object? There are times when I need to add minutes, or hours, or a combination of both - and I want the resulting total time to be return ...

Eliminate repeated datetime index values by including small increments of timedelta

Here is the provided data: n = 8 np.random.seed(42) df = pd.DataFrame(index=[dt.datetime(2020,3,31,9,25) + dt.timedelta(seconds=x) for x in np.random.randint(0,10000,size=n).tolist()], data=np.random.randint(0,10 ...

What is the best way to find out if multiples of a specific time interval can evenly divide the time between two

I'm currently utilizing Luxon for handling dates and durations. I have two specific dates and an ISO duration, and I am looking to figure out how to determine if the interval between the dates is a multiple of the specified duration without any remainder. ...

How to format PHP time differences according to the number of days

Currently, I am using this PHP code to calculate the time difference and display it in days, hours, and minutes. // Comparing expires_at with current time $now = new DateTime(); $future_date = new DateTime($contest->expires_at); $interval = $future_da ...

Formatting Date and Time in the Gridview of my Asp.net Application

I have been using this format to display the date and time in a grid. The issue I am facing is that I cannot retrieve the exact HH:MM from the database. Even though the database shows 11:11, my grid is displaying 11:03 instead. Here is the value stored in ...

What is the technique for arranging the display of a component in React?

Is there a way to dynamically render a component in my react-app at a specific date and time, like 6.00PM on October 27, 2022? I want to release a form for signing up starting from that exact moment. The timestamp information will be stored in my database ...