Questions tagged [date]

A date refers to a specific day marked on a calendar, incorporating details of the year, month, and day. Discuss topics related to generating, manipulating, and preserving date information within various programming languages.

Adjust the formatDate function in the Material UI datepicker

I recently implemented the material-ui datepicker component with redux form and it's been working great. However, I have encountered a minor issue. Whenever I change the date, it displays in the input field as yyyy-mm-dd format. I would like it to appear a ...

What method can I use in pure Javascript to identify which day the week begins on, either Monday or Sunday, based on the

Can someone help me determine the start day of the week in local time using only Javascript? The start day could be Monday, Sunday, Saturday, or Friday. I came across this helpful resource on Stack Overflow: <firstDay day="mon" territories="001 AD AI ...

Angular Date Filtering to Show dd-mm-yyyy Format

I am having trouble filtering the date correctly in my controller. My desired date format is Thu Mar 31 2016 05:05:00 GMT-0400 (EDT). However, when I use the code mentioned above, the results show up as 03-31-2016. This is the code snippet from my contr ...

Utilize a Vue.js filter on the v-model within an input element

Seeking assistance! I successfully created a directive that wraps the Jasny Bootstrap Plugin, specifically focusing on the input mask feature! Additionally, I have developed a custom filter using moment to format date fields! The date format received fro ...

How can strings of dates be arranged in MM/DD/YYYY order?

Is there a correct way to sort these dates in descending order? I've attempted using arr.sort() and arr.sort().reverse(), searched extensively on stack overflow, but still cannot find a solution. Every attempt at sorting them seems to be incorrect. [ ...

What is the procedure for adding Date to ArangoDB?

I am struggling to comprehend the date storage format used by ArangoDB. I made an attempt to insert a date using the following format: {"name": "vasia", "date": date("2013-01-15")} std.json.JSONException@C:vibe-d-0.7.24sourcevibedatajson.d(1116): (1 ...

Navigating Timezones with PrimeNG Calendar Component <p-calendar>

I am experiencing an issue with PrimeNG in a multi-user environment where each user is in a different timezone. I need all users to submit their form data in EST, but it seems like the browser is converting the dates to the user's local timezone upon submi ...

Convert the Date FR and Date US formats to ISO date format

There is a function in my code that accepts dates in different formats. It can handle two formats: 2022-06-04 or 04/06/2022 I want all dates to be in the format: 2022-06-04 For instance: public getMaxduration(data: object[]): number { data.forEach((l ...

Use regular expressions to filter a pyspark.RDD

I am working with a pyspark.RDD that contains dates which I need to filter out. The dates are in the following format within my RDD: data.collect() = ["Nujabes","Hip Hop","04:45 16 October 2018"] I have attempted filtering t ...

Date range within a conditional statement

I have encountered this code snippet: function auto_select_param_call_time() { if (today() == date("02.01.2017") || today() == date("03.01.2017")) { auto_click_param("call_time", "Non-working day"); } else { //Do something else ...

What is the reason behind the inconsistent behavior of Javascript's Date.getDate() and .setDate() methods?

As a hobbyist coder, I'm facing a challenging problem with building a dynamic HTML/CSS calendar. My goal is to have cells filled in based on today's date. However, when I attempt to add days to fill in another 13 days by looping through HTML elem ...

PHP code to determine the next occurrence of a specific date in the future

I am searching for a function that can determine the first year from now on when a specific date (month and day) will occur. function getYear($day, $month) { // ... return $year; } The values of $day and $month are always two-digit numbers. For inst ...

Tips for determining the duration between the Monday of last week and the Sunday of last week

Can anyone help me figure out how to retrieve the dates from last week's Monday to last week's Sunday using JavaScript? I've searched through various sources with no luck. Hoping someone here can provide some guidance. ...

Calculate the number of days between two dates using PHP and MySQL with DatePeriod

I have a DatePeriod object set up using PHP: $start = new DateTime('2016-03-01'); $end = new DateTime('2016-03-01 + 1 month'); $period = new DatePeriod($start, new DateInterval('P1D'), $end); and I also have a SQL Table with work dates: https://i.st ...

PHP for Calculating Time to Percentage

I have a question that may seem simple, but I'm unsure how to convert the time difference between two dates into a percentage. Currently, I am utilizing a JQuery plugin available at: The specific script on the page responsible for calculating the percent ...

Is it better to store the current date in the web application or directly in the database?

Imagine you are developing a web application similar to a message board, where you need to store the timestamp when a message is submitted. The question arises: is there a significant difference between obtaining the date within the application code or let ...

Visualizing Data with Flot.js - A Comprehensive Guide

Does anyone know how to organize values in a flot histogram by day, merging them into one bar per day? I've been searching for a solution but can't seem to find one. __ If you have any ideas, please share! ...

Using PHP to implement conditional statements for multiple days of the week

Could this be done? $d=date("D"); ... else if ($d=='(Thu|Fri|Sat)') { I have managed to make it work for one day of the week. if ($d=='Wed') { Thank you ...

Gson throwing an error with an unparsable date format?

I am encountering an issue while attempting to parse JSON data with a Java POJO class. Below is the JSON and POJO structure: JSON: { "startDate": "2018-09-18T12:00:00+0000", "endDate": "2018-09-18T14:00:00+0000", "startDateAsDate": 153 ...

Angular CRUD Form Data Conversion Update

After selecting the date 3/2/2021 in my Angular create CRUD form, it gets passed to MongoDB as 2021-03-02T00:00:00.000+00:00 and then displayed on the update CRUD form as 2021-03-02T00:00:00.000Z. How can I convert this to 'M/d/yyyy' format? (I am able to ...

What is the best way to iterate a loop in PHP from a specified start date to an end date, progressing at three-month intervals

Today, I have a question regarding PHP date manipulation. Code $calcdateloops = date("Y-m-01", strtotime(date('Y-m-d')." -1 year -6 Month")); //2015-01-01 $enddate = date('Y-m-d'); Now, my goal is to divide the dates into quarters, meaning every 3 mon ...

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 ...

"Unlock special birthday surprises with our exclusive AJAX birthday code

Looking for assistance to update the code snippet below for the current date: For example, if today is 18/04/2014, then: day=18 month=04 year=14 If you don't understand: <select name="day" id="day"> <option value="na">day</option> ...

Tips for handling an incorrect date entry when a field loses focus in AngularJS

If I have an <input> field with the type='date' attribute in its untouched state, it displays mm/dd/yyyy as the date format. I am looking to see if there is a way to utilize AngularJS ng-blur directive to reset the field to this original fo ...

The date provider in Factory Boy is producing a string value

I've been working on an app where I am using the factory_boy package to generate random data, but I'm having some trouble with the date provider :( class MyModel(models.Model): date = models.DateField() class MyModelFactory(factory.DjangoModelFactory ...

Finding a date after a specific time period using PHP

I am currently utilizing the Yii framework and I have a query regarding getting the current date in PHP (Yii framework) using the following code snippet: $date = new CDbExpression('NOW()'); When executed, it returns the date in the format of "2013-04-27 ...

What is the best way to populate empty dates within an array of objects using TypeScript or JavaScript?

I am trying to populate this object with dates from today until the next 7 days. Below is my initial object: let obj = { "sessions": [{ "date": "15-05-2021" }, { "date": "16-05-2021" }, { "date": "18-05-2021" }] } The desired ...

Finding the earliest date in a Laravel collection

I have a collection named promotions which contains several promotions, each of which has multiple exceptions: foreach ($promotions as $p) { $t = $p->exceptions() ->where('sunday','on') ->whereDate('start','<=', $c_ ...

PHP: Retrieving the current time zone from the database

In my database, I save dates in DATETIME format as Y-m-d H:i:s. My goal is to display the date from the database in the user's local time. For instance, if the user is located in France, I want to show their timezone. Is there a way to accomplish thi ...

Transforming the timezone of a date from the Backend to the timezone selected by the user in the User

I have an API that provides dates in the format: 12/23/2023 at 03:31 a.m. CST My goal is to convert this to a date with the user-selected timezone in the following format: 12/23/2023 at 7:31 p.m. The timezone part is not required for display in the UI. c ...

Arranging Json by date in descending order

I am working with a json feed that contains articles, and new ones are added every few days. I need to retrieve the latest three articles, but the json is not sorted by date. I am unsure how to rearrange it from newest to oldest based on the date field. ...

Ways to display JSON in a structured format on an HTML page

Is there a way to display JSON in a formatted view on my html page? The JSON data is coming from a database and I want it to be displayed neatly like the following example: { "crews": [{ "items": [ { "year" : "2013", "boat" ...

Discovering the duration of a week or the week range from Sunday to Friday using PHP

Can you provide guidance on how to determine the week duration or week range from Monday to Friday for a specific date using PHP? For example, let's say we have the following date: $date = "2013-02-24"; I am interested in obtaining the date range fr ...

What strategies can be employed to maintain reliable datetime management for a reservation system operating in diverse time zones?

Looking at the big picture: An interesting scenario arises when a hotel owner specifies a time frame for booking reservations at a restaurant (5pm - 10pm). Along with this information, there is also a timezone provided to ensure that dates are displayed i ...

The date format is malfunctioning -> Error: The date provided is not valid

My goal is to convert the date format from 2022-01-17T21:36:04.000Z to January 18th using the npm package, dateFormat. I found success with the following code snippet: const date = dateFormat("2022-01-17T21:36:04.000Z", "mmmm dS"); However, when trying t ...

"The Jquery new Date function is returning inaccurate data when trying to pass it in the format yyyy dd

While utilizing remote desktop, I have come across the following code snippet in my JavaScript file: var birthday = new Date(2017, 1, 1); console.log(birthday); The output generated is as follows :- Wed Feb 01 2017 00:00:00 GMT+0000 (Coordinated Univ ...

Converting date string to time format displaying how long ago it occurred

I need help creating a PHP function that takes a $date variable in the format: 03/09/2016 - 12:02. The goal is to turn this date/time variable into a string indicating how many days and hours have passed since that date. Here's the function: $date = $r- ...

Check to see if the date selected from the HTML5 date picker is in the past compared to the current date

When working with HTML, I have a task where I need to input a date (mm/dd/yyyy) using the new HTML 5 date picker: <input name="date" type="date"> My goal is to validate whether the date entered is older than today's date. $this_date = $_POST['dat ...

Discover the method to retrieve the month name from an HTML Date input value

Here we have a date input field <input id="customer-date" name="customer-date" type="date" required> Accompanied by this script const customerDate = document.getElementById('customer-date').value; const dateHandler = document.getElementById('date- ...

saving user input dates into a MySQL database

Below is the code for my form: *my database uses the date format Although I am confident that there are no errors in my code, when I click the upload button, the date appears as 0000-00-00. <form action="imageupload.php" method="post" enctype="multip ...

Dealing with an Incorrect Date in JavaScript

After working on a JavaScript logic to extract date and time from certain values, I realized that my approach needed some adjustments. Initially, I parsed the DateTime and converted it to a string. Then, I split the string to retrieve the date component. ...

Employing the date time difference when considering different time zones

I came across a helpful link earlier on the topic of calculating time differences in minutes, hours, and days: How to get time difference in minutes in PHP Here is an example I was experimenting with: $date1 = new DateTime('first day of this ...

What is the process for adjusting the color of a particular date in the <input type=Date> field?

Is there a way to modify the styling, such as color, of the input type date in HTML 5? In HTML 5, we can display a calendar using <input type=date>. For example, if March 23rd is a holiday and I want to highlight this specific date in red, how can I ...

Matching the date format from Express/MongoDB req.params to the date format in a MongoDB document

I am currently working with a MongoDB collection called SlopeDay which contains dates. https://i.stack.imgur.com/xw5bb.png In my express routing, I am trying to reformat the date to MM-DD-YYYY in order to use it for the URL. This URL will be used to retr ...

Combine elements of a tuple to create a coherent date and time structure

I've taken up the challenge of learning Python through practical applications. To start off, I have a basic log file: LOGON, Thu 30-01-2014, 12:38:01,11, username1, machinename LOGOFF, Thu 30-01-2014, 12:56:41,57, username2, machinename LOGON, Thu 30-01 ...

How can the date format in a CSV file be modified using Python?

Looking to convert the date format from 30-Jan-02 to 30.Jan.2002 when it appears in the second position within a CSV file using Python. I've made several attempts, but I'm getting caught up with compatibility between strings and bytes. import os ...

How can I adjust the format of a timestamp field from the database to adhere to Dutch locale conventions?

I am attempting to convert a timestamp string from the database into a Dutch locale format that resembles: Maandag 2 juli 2013 My approach was as follows: <?php setlocale(LC_ALL, 'nl_NL'); echo strftime("%A %e %B %Y", mktime($vac->gepl ...

What steps should I take to generate a stylized date input in javascript?

Looking to dynamically create a date string in JavaScript with the following format: dd-MMM-yyyy Need the dd part to change between 1 and 29 each time I generate the variable within a loop Month (MMM) should be set as Jan ...

Obtain the name of the month from the given date input

Hey there! I've been working on a function that allows users to input their birthdate and receive relevant information, like the month name corresponding to the date they entered. However, I'm currently only getting the month number instead of the month ...

What is causing the error message stating that the DateTime class object cannot be converted to a string?

I found this code snippet on a programming forum function increaseDate($date_str, ${ $date = new DateTime($date_str); $start_day = $date->format('j'); $date->modify("+{$months} month"); $end_day = $date->format('j'); if ...

The system encountered an error when attempting to convert the data '19-10-2002' into a date format

I am trying to pass a date parameter in the format (dd-MM-yyyy) and then convert it into the format (yyyy-MM-dd) before sending it via API. Here is my code: convert(date:string){ date //is in the format(dd-MM-yyyy) date = formatDate(date , " ...

What is the best way to retrieve the dates for the current month as well as the following month

I have a php script that I need to modify in order to display the current month and the next month's dates using PHP. Below are the functions I am currently using for this purpose. html/php code (functions for current month and next month): <!-- Displa ...

The model in Phalcon is encountering an issue with saving due to an invalid datetime value of '1540564519' in the 'date_updated' column of row 1

I am encountering an issue while attempting to store data in a table. The error message that is being thrown upon saving is as follows: SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '1540564519' for column 'da ...

SQL injection for storing hidden dates

When I submit a value using my form, I want the date to be saved in the MySQL database. The user does not need to see it, but I need the dates for a future function where I can loop through the registered dates in the database. Do I need to create a hidde ...

Exploring dates with Python's BC capabilities

My upcoming project involves creating an app using Python that will deal heavily with dates in BC (Before Christ) era, including storing, retrieving in a database, and performing calculations on them. Most of the dates will be uncertain, such as "around 20 ...

What is the process for adding dates chosen from dropdown menus into a mySQL table using PHP?

Is there a way to insert the selected date and time from 5 dropdowns (Y, m,d, H,i) into a mySQL table as a datetime using PHP5? To combine the values into a string: $DateTime="$Year-$Month-$Day $Hour:$Minute:00"; You can then use strtotime function: $D ...

Storing dates using Angular 2 and JSON for efficient data management

I've encountered a challenging issue with my Angular 2 application. I'm attempting to organize my API (MongoDB) in such a way that each new "post" added by the admin can be retrieved by date (not time) on the front end. Here's an example of how my schema l ...

Deactivate any days occurring prior to or following the specified dates

I need assistance restricting the user to choose dates within a specific range using react day picker. Dates outside this range should be disabled to prevent selection. Below is my DateRange component that receives date values as strings like 2022-07-15 th ...

VBA - Selenium does not support pasting dates on Chrome browser

When using internet explorer, I was able to change the date on a web page with the code (code1) provided. However, after switching to Chrome and utilizing Selenium (as in code 2), the date section on the web page only partially changes. For example, if th ...

The date formatting issue persists in jqGrid 3.5 as the dates are not being displayed correctly

I have been experimenting with jqGrid 3.5.2 and currently, I am extracting data from a local JSON object. Upon researching date formatting, I realized that the dates in my JSON were not properly formatted, so I converted them all to ISO8601Long format. Now ...

Having trouble finding elements for the Date field in automation using Selenium and Python

I am currently working on automating tasks on Expedia.com, and I have outlined the following steps: Visit Expedia.com Click on the Flights button The default option will be set to Round trip Select a value from the Leaving from dropdown menu Select a valu ...

Determine if a specific date occurred at least one day ago using momentjs

Is there a way to determine if a specific date is at least one day (24 hours) in the past using momentjs? For example: const currentDate = moment() const isAtLeastOneDayAgo = currentDate.subtract(dateToVerify) > 1 // How can this be done? ...

Troubleshooting Date Errors in Typescript with VueJS

Encountering a peculiar issue with Typescript while attempting to instantiate a new Date object. <template> <div> Testing Date</div> </template> <script lang="ts"> import Vue from "vue"; export default Vue.extend({ name: ...

Is there a way to figure out the number of days from the current date using jQuery UI datepicker?

Hello there, I'm currently facing an issue with calculating the number of days from the present to a chosen date after utilizing a jQuery datepicker. It seems that the date formatting is getting altered upon selection, causing discrepancies in the ca ...

Having trouble retrieving the selected date from the Material-Ui datepicker after the first selection

I am facing an issue with the material-ui dateandtimepicker where I am unable to retrieve the date value on the first select. The value only shows up after the second click, and it's always the previous one. Is there a way to convert the date to a format l ...

Tips for setting a blank date field as the default value in a ui-datepicker in Vue.js

I'm working with a ui-datepicker in vue.js and I need to have the field empty or blank by default. <ui-datepicker label="Date" v-model="searchDate" :custom-formatter="picker9Formatter" :lang="picker12Lang"> </ui-datepicke ...

Is there a way to convert dates and times in R similar to strtotime

Have you ever heard of PHP's amazing function, strtotime? It can take any string with almost any date format and convert it into a time value (count of seconds since 1970). What I love about it is its future-proof nature compared to functions like str ...

Switching the input of data from a string format to a date format

One of the components in my registration form requires the user to input their start date. I am currently utilizing a MEAN Framework, specifically AngularJs for the front end development. Progress so far: Initially, I attempted using the code snippet bel ...

Ways to discover the present date and transition to the following date?

Currently, I am encountering an issue with my automation script. My script utilizes the selenium tool along with Java language. The specific problem I am facing involves the need to view the current date after clicking on a calendar and verifying if a flig ...

Customizing the date format for each IService in ServiceStack, rather than applying it globally

In my content management system, I have decided not to use the native .NET (WCF) date formatting that is preferred. Instead, in my custom IService, I have set: JsConfig.DateHandler = DateHandler.ISO8601;" However, this decision appears to have caused the ...

When creating a new instance of the Date object in Javascript, the constructor will output a date that is

In my project using TypeScript (Angular 5), I encountered the following scenario: let date = new Date(2018, 8, 17, 14, 0); The expected output should be "Fri Aug 17 2018 14:00:00 GMT-0400 (Eastern Daylight Time)", but instead, it is returning: Mon Sep ...

Looking into time zones that do not observe daylight saving time

My code successfully converts timezones to GMT/UTC and vice-versa. However, I am looking to enhance its functionality by checking for non-DST timezones and allowing for dates/times in any format. For example, if only a date is provided, the correct result ...

Dateutil - Your Trusted Source for Relative Date Calculation

Recently, I've been facing a challenge while attempting to parse relative dates like "today at 4:00", "tomorrow at 10:00", "yesterday at 8:00", etc. in Python using dateutil.parse. However, I wish to provide a specific "today" date to serve as a reference ...

When provided with varied inputs, new Date() yields distinct values for various time zones

var date1 = "2015-03-29"; console.log(new Date(date1)); //Output:Sun Mar 29 2015 05:30:00 GMT+0530 (India Standard Time) var date2 = "1869-12-31"; console.log(new Date(date2)); //Output:Fri Dec 31 1869 05:53:20 GMT+0553 (India Standard ...

Utilize Vue js on Laravel to modify the WP REST API Date representation

Hey there! I'm trying to display the date my post was created in WordPress using Vue.js. Currently, it's showing up in a weird format like this: 2018-08-06T18:29:59 Here is the code I have in my .vue file: <div class="date-below"><p>create ...