I tried to compare two date objects in angular 4 but it always returning false  below are my code snippet  CheckForHoliday(d: Date) {   let simpleDate = new Date(d.getFullYear(), d.getMonth(), d.getDay());   let hDate = new Date(2018, 9, 1);   console.log(simpleDate + "==========" + hDate);   console.log(hDate === simpleDate);    return (hDate === simpleDate); }   The output is as below  Mon Oct 01 2018 00:00:00 GMT+0530 (India Standard Time)==========Mon Oct 01 2018 00:00:00 GMT+0530 (India Standard Time)  false  Any Idea why it returning false when the printed values look same?
673
Can someone suggest a way to compare the values of two dates greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes.
65271
I want to check the time      Eastern Daylight Time   Time zone in Washington, DC, USA (GMT-4)   Thursday, May 9, 2019, 8:11 PM   However,   $ TZ="EDT" date Fri May 10 00:12:25 EDT 2019   "EST" works properly  $ TZ="EST" date Thu May  9 19:13:11 EST 2019   What's the problem?
56034
I doubt I am the only one who has come up with this solution, but if you have a better one please post it here. I simply want to leave this question here so I and others can search it later.   I needed to tell whether a valid date had been entered into a text box and this is the code that I came up with. I fire this when focus leaves the text box.  try {     DateTime.Parse(startDateTextBox.Text); } catch {     startDateTextBox.Text = DateTime.Today.ToShortDateString(); }
75387
Suppose I have a particular date stored in a variable date_m. I want ((date_m)-25) date.   For example: I have 15/09/2014 stored in my variable , then I want 21/08/2014 returned if I subtract 25 from the date stored in variable.
101677
I'd really like a user option to show all dates as yyyy-mm-dd HH:mm after the 2 day mark. I find the existing non-standard semi-verbose American Mon DD 'YY style date to be ugly and difficult to parse.  I am not asking for anything complicated here, just a simple user option to show the date and time in the international ISO 8601 format across the board. Since it's already in the tooltip everywhere, it should be a simple change to optionally show it in the page body for those users who want it.  Secondarily, if it's not too difficult, I'd very preferably like to see date &amp; times in my local time, rather than the UTC time as is currently shown used. It seems to make much more sense to me for see a question "asked 2014-02-04 10:19" as being my local time - I don't know what UTC is without using a converter (in this the before-2-days "asked 6 hours ago" is quite good).  (Re-raising this feature-request at the explicit behest of moderator Anna Lear; please don't close as a duplicate).
30685
I have a Timestamp value that comes from my application. The user can be in any given local TimeZone.  Since this date is used for a WebService that assumes the time given is always in GMT, I have a need to convert the user's parameter from say (EST) to (GMT). Here's the kicker: The user is oblivious to his TZ. He enters the creation date that he wants to send to the WS, so what I need is:  User enters: 5/1/2008 6:12 PM (EST)  The parameter to the WS needs to be: 5/1/2008 6:12 PM (GMT)  I know TimeStamps are always supposed to be in GMT by default, but when sending the parameter, even though I created my Calendar from the TS (which is supposed to be in GMT), the hours are always off unless the user is in GMT. What am I missing?  Timestamp issuedDate = (Timestamp) getACPValue(inputs_, "issuedDate"); Calendar issueDate = convertTimestampToJavaCalendar(issuedDate); ... private static java.util.Calendar convertTimestampToJavaCalendar(Timestamp ts_) {   java.util.Calendar cal = java.util.Calendar.getInstance(       GMT_TIMEZONE, EN_US_LOCALE);   cal.setTimeInMillis(ts_.getTime());   return cal; }   With the previous Code, this is what I get as a result (Short Format for easy reading):  [May 1, 2008 11:12 PM]
79605
I have an issue -   The javascript Date("mm-dd-yyyy") constructor doesn't work for FF.  It works fine for IE.   IE : new Date("04-02-2008") => "Wed Apr 2 00:00:00 EDT 2008" FF2 : new Date("04-02-2008") => Invalid Date       So lets try another constructor. Trying this constructor Date("yyyy", "mm", "dd")   IE : new Date("2008", "04", "02"); => "Fri May 2 00:00:00 EDT 2008" FF : new Date("2008", "04", "02"); => "Fri May 2 00:00:00 EDT 2008" IE : new Date("2008", "03", "02"); => "Wed Apr 2 00:00:00 EDT 2008" FF : new Date("2008", "03", "02"); => "Wed Apr 2 00:00:00 EDT 2008"   So the Date("yyyy", "mm", "dd") constructor uses an index of 0 to represent January.   Has anyone dealt with this? There must be a better way than subtracting 1 from the months.
94071
How do I get the difference in days between 2 dates in SQLite? I have already tried something like this:  SELECT Date('now') - DateCreated FROM Payment   It returns 0 every time.
104794
I have a CPT for events. I need to display future events for people to register, while hiding past events.  What is the easiest date format for both (1) entering date when creating new event and (2) comparing event dates with current date ?
106040
I've been using Javascript's Date for a project, but noticed today that my code that previously worked is no longer working correctly. Instead of producing Feb as expected, the code below produces March.   My code looks something like this:   current = new Date(); current.setMonth(current.getMonth()+1); //If today is Jan, expect it to be Feb now   This code worked everyday up until today. Is this a Javascript bug or am I going about this the wrong way?
18077
Given the following components  DECLARE @D DATE = '2013-10-13' DECLARE @T TIME(7) = '23:59:59.9999999'   What is the best way of combining them to produce a DATETIME2(7) result with value '2013-10-13 23:59:59.9999999'?  Some things which don't work are listed below.    SELECT @D + @T       Operand data type date is invalid for add operator.     SELECT CAST(@D AS DATETIME2(7)) + @T       Operand data type datetime2 is invalid for add operator.     SELECT DATEADD(NANOSECOND,DATEDIFF(NANOSECOND,CAST('00:00:00.0000000' AS TIME),@T),@D)      The datediff function resulted in an overflow. The number of dateparts   separating two date/time instances is too large. Try to use datediff   with a less precise datepart.   * The overflow can be avoided in Azure SQL Database and SQL Server 2016, using .    SELECT CAST(@D AS DATETIME) + @T       The data types datetime and time are incompatible in the add operator.     SELECT CAST(@D AS DATETIME) + CAST(@T AS DATETIME)      Returns a result but loses precision 2013-10-13 23:59:59.997
105204
Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT?  Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?
6719
Given two date ranges, what is the simplest or most efficient way to determine whether the two date ranges overlap?  As an example, suppose we have ranges denoted by DateTime variables StartDate1 to EndDate1 and StartDate2 to EndDate2.
88277
I constantly have problems working with dates in Excel, I must be doing something wrong but I don't understand what.  I have a spreadsheet, exported from our exchange server, that contains a column with dates on. They have come out in US format even though I'm in the UK.   The column in question looks like this  04/08/2012 04/09/2009 04/01/2010 04/21/2011 04/05/2012 08/30/2009 08/29/2010 08/28/2011   In Excel, I have highlighted the column and selected Format Cells.... In this dialog box, I have selected the Date, selected English (United States) as the locale and chosen the matching date format from the list. I hit OK and try to sort the data by this column.   In the sort dialogue I choose this column, select sort on Values but the order only gives me options for A to Z, not oldest to newest as I would expect.  This in turn sorts the date data by the first two digits.  I am aware I could re-format this data to ISO and then the A to Z sort would work but I shouldn't have too, I'm obviously missing something. What is it?  EDIT: I messed up the bounty but this should have gone to @r0berts answer, his first suggestion of Text to Columns with no delimiter and choosing 'MDY' as the type of data works. Additionally, if you have a time (i.e. 04/21/2015 18:34:22), you need to first get rid of the time data. However after that the method suggested by @r0berts works fine.
92316
I am working on a formula based on a date/time value to extract the time for the field. This field is based on the Pacific Time Zone and as is appears as  04/04/2016 9:00 PM  I set up this formula below  LEFT(RIGHT(text(  HOC__End_Date_Time__c ),9),7)  However the return result is based on GMT and returns based on a 24-hour clock, is there a way to adjust so it can simply display as 9:00 PM rather than as 24:00.  Hope it helps.
73005
I have a new Ubuntu Aquaris E4.5 phone (latest updates installed).  Locale UK Timzone British Summer Time.  The Today Scope screen does not automatically change days, so for example today is Thursday, but this morning is was still showing Wednesday.  The only way I could seem to get it to change was to reboot the phone.  Is this a bug? or have I done something wrong?
45803
I am trying to show the current date in my JSP page using JSTL. below is the code I am using.  &lt;jsp:useBean id="now" class="java.util.Date" scope="request" /&gt; &lt;fmt:formatDate value="${now}" pattern="MM.dd.yyyy" /&gt;   But the above code is not producing any results? Am I missing anything here or is there any better approach for this? I am using JSTL 1.1.