I'm having a weird issue with MongoDB in Windows 10. I've migrated a database that's working perfectly fine in MacOS and Linux to a Windows 10 machine.  Same mongodb version : 3.4.7  The issue seems to be related to one that other people experienced but it's not exactly the same ( )  I get an error saying "gmtime failed - your system doesn't support dates before 1970" when I call a view that uses $dateToString in the projection.  And I also get only 101 records if I call the same view via Robo 3T.  But the difference in my case is that I don't have dates before 1970 in this particular collection.  So I ran this code on Robo 3T to try something, and I can't understand the result:  db.getCollection('vehicles').find({}).forEach(function(vehicle){    var date = new Date(vehicle.dates.entry);    print(date);    print(date.getYear());    })   This is the result for one record:  Fri Oct 02 2015 00:00:00 GMT+0100 (GMT Standard Time) 115   So the date seems to be constructed properly but the getYear() returns 115 instead of 2015.  The same code on MacOS or Linux works as expected.  Any ideas? Thanks
80895
Why does this javascript return 108 instead of 2008? it gets the day and month correct but not the year?  myDate = new Date(); year = myDate.getYear();   year = 108?
87792
I asked  yesterday, approximately 18 hours ago ("2011-12-13 20:24:03Z" according to the hover text), and it's still being displayed as "today".  I assume the "Z" in the timestamp refers to Zulu time, so I , and the date (2011-12-14) differs from the timestamp on the question.  I don't pretend to understand all of the complexities when converting time zones, but I thought it was strange enough to report. If it matters at all, I'm in US-Eastern.
102155
Background When a date is to be shown that is from this year it is shown as &quot;Mar 12&quot; for the &quot;12th of March&quot; rather than &quot;Mar 12 '14&quot;. While the full form is not what I'm used to (as a European) it is at least unambiguous. However &quot;Mar 12&quot; reads as &quot;March 2012&quot; to me and confuses me every time. Although I have (after months of pain) stopped misreading it I still feel the Parse Error: Needs Stack Exchange Mode and the slight pause as my brain tried to reparse it. The most recent example of someone confused by this is here . I was myself caught by this . Feature request Even for recent dates; once the date is shown at all show the full date including the year. So this post was posted on Mar 22 '14. This seems to have no downsides as it takes no extra space (there needs to be space for the long form anyway) and is much clearer to those of us who don't use an American date system.
492
I have a web page with three dropdowns for day, month and year. If I use the JavaScript Date constructor that takes numbers, then I get a Date object for my current timezone:  new Date(xiYear, xiMonth, xiDate)   Give the correct date, but it thinks that date is GMT+01:00 due to daylight savings time.  The problem here is that I then pass this Date to an Ajax method and when the date is deserialised on the server it has been converted to GMT and so lost an hour which moves the day back by one. Now I could just pass the day, month, and year individually into the Ajax method, but it seems that there ought to be a better way.  The accepted answer pointed me in the right direction, however just using setUTCHours() by itself changed:  Apr 5th 00:00 GMT+01:00    to  Apr 4th 23:00 GMT+01:00   I then also had to set the UTC date, month and year to end up with  Apr 5th 01:00 GMT+01:00   which is what I wanted.
113875
I have 4 fields with Date Time values, and created a new field (Date type as well) which takes the most recent date from these 4 fields. I have tried using the Max python in the field calculator to populate this new field, but it does not use the most recent date from these 4 fields. Does this function not work with Datetime values, or is there another function for this that I am not able to find on these forums.   max([!field1!, !field2!, !field3!, !field4!])   I am on 10.5.  When I have two fields that have a date within the same month, it will not read the rest of the date correctly. (See picture attached)    When I run the following updated code it fails and says it is a syntax error.      With the current code, it reads the first number in the day to select the most recent date. (As shown below). It does not use the correct chronological format, even though the strptime format worked previously.
60348
I've been through associated answers but cannot quite seem to find something which works!  I'm having trouble getting TimeManager to recognise a simple data field (this is in QGIS2 - but I've had this error in earlier versions). I have these fields formatted in what appears to be one of the acceptable formats:    ... here is a screenshot of the field properties:    The format appears to be recognised in QGIS as I've worked out days difference between two dates (the "Time on Market" field shown in the image).  However ... I always end up with:   The Twitter.shp file works fine as a test, so I don't think this is an issue with the install / phyton conflict.  Any thoughts welcome!
110548
Is it possible to customize data (or date-time) format in Windows (I am using Windows&nbsp;XP)?  The current format which is followed by the OS [to show date-modified, etc.] is MM/DD/YYYY or M/D/YYYY, whereas I have been comfortable with DD/MM/YYYY or D/M/YYYY format. I am finding it hard to refer Date-modified [which I use often] of files and folders.
44774
I have a table structured like this:  CREATE TABLE [TESTTABLE] (     [ID] [int] IDENTITY(1,1) NOT NULL,     [DateField] [datetime] NULL,     [StringField] [varchar](50),     [IntField] [int] NULL,     [BitField] [bit] NULL )   I execute the following code:  BEGIN     INSERT INTO TESTTABLE (IntField, BitField, StringField, DateField)     VALUES ('1', 1, 'hello', {ts '2009-04-03 15:41:27.378'});       SELECT SCOPE_IDENTITY()   END   And then   select * from testtable with (NOLOCK)   and my result shows:  2009-04-03 15:41:27.*377*   for the DateField column.  Any ideas why I seem to be losing a millisecond??
61077
I'm currently using  \usepackage[UKenglish]{babel} \usepackage{datetime}   and I'm getting  Sunday 4th September, 2016  with the commands \today or with \newdate{example}{01}{09}{2016} (outside of \begin{document}) and \displaydate{example} inside the document.  How can I reformat this date to not have the name of the day in it (Best would be with using datetime2)? So like 4th September, 2016. With the "th" as a high letter like this:   Full document example:  \documentclass[a4paper, 12pt, DIV=calc, headings=small]{scrreprt} %Used packages \usepackage[UKenglish]{babel} \usepackage[utf8]{luainputenc} \usepackage{datetime}  %Other definitions \pagenumbering{arabic}  \newdate{sample}{31}{01}{2017}   \begin{document} \displaydate{sample}\\ \today \end{document}
58756
I am interested in determining the ages of all 70+ my servers. I would like to create a growth graph showing when servers and databases were added to the environment either/both monthly or annually. I executed the following query using the SSMS multi-query feature with only partial success.  SELECT [name], create_date FROM sys.databases   It's partial success because the master and model databases return with a date of 'April 8, 2003' when I know that I created some of these servers during the past couple years.  I refresh databases from one server to another several times a week, which appears to be causing issues with the database create date.   Is there a simple method to determine the actual create date for both servers and databases?
101492
I suspect I know the answer to this, but...  In 10.7, versions of a document are saved automatically. You can also explicitly save a version by selecting "Save a Version".  When I wish to revert to a previous version, in the Time Machine-like display that appears, there seems to be no way to identify which versions it's showing me were saved automatically by the system, and which were (what I consider to be) the "milestone" versions that I saved explicitly.  Am I missing something? I know you're given the opportunity to revert to the last-saved version when you select File->Revert, but what if I just want to look at that version first, or revert to the last-but-one saved version?
18574
I'm trying to convert a date string into an age.  The string is like: "Mon, 17 Nov 2008 01:45:32 +0200" and I need to work out how many days old it is.  I have sucessfully converted the date using:  &gt;&gt;&gt; time.strptime("Mon, 17 Nov 2008 01:45:32 +0200","%a, %d %b %Y %H:%M:%S +0200") (2008, 11, 17, 1, 45, 32, 0, 322, -1)   For some reason %z gives me an error for the +0200 but it doesn't matter that much.  I can get the current time using:  &gt;&gt;&gt; time.localtime() (2009, 2, 3, 19, 55, 32, 1, 34, 0)   but how can I subtract one from the other without going though each item in the list and doing it manually?
87937
Is it possible to configure Windows 7 to use YYYY-MM-DD instead of DD/MM/YYYY as the date format? How? Where?
120935
Context: MySQL version  On MySQL 5.7.17 (as shown by SHOW VARIABLES LIKE "%version%";)  Context: MySQL timezone settings  and with SELECT @@global.time_zone, @@session.time_zone; yielding  +--------------------+---------------------+ | @@global.time_zone | @@session.time_zone | +--------------------+---------------------+ | SYSTEM             | SYSTEM              | +--------------------+---------------------+   ...which means the server tracks the system timezone.  Context: System timezone  This being a Linux, we check the system timezone like this (output redacted):  $ timedatectl       Local time: Wed 2018-02-14 13:21:30 GMT   Universal time: Wed 2018-02-14 13:21:30 UTC         RTC time: Wed 2018-02-14 13:21:30        Time zone: Europe/London (GMT, +0000)   Context: What we know    (there is no clear description of this in , except "MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. (This does not occur for other types such as DATETIME.)"; note that "converts TIMESTAMP values to UTC for storage" actually makes sense only as an implementor's note, it's not useful to the user - what is important is that TiMEZONE always returns the correct value in whatever timezone one is in, while DATETIME will always return the same value in whatever timezone one is in)   Context: Current time  It's now around :  $ date +"The current time is %s alias %c" The current time is 1518617572 alias Wed 14 Feb 2018 14:12:52 GMT   Problem  Let's run:  SELECT NOW(),FROM_UNIXTIME(0),UNIX_TIMESTAMP(),FROM_UNIXTIME(UNIX_TIMESTAMP());   The output (suitably pivoted by hand; there should be an option to do that):  NOW()                            2018-02-14 14:15:13  -- Display "now" in SYSTEM timetone: OK FROM_UNIXTIME(0)                 1970-01-01 01:00:00  -- Display 1970-01-01 00:00:00 in SYSTEM timetone: NOT OK UNIX_TIMESTAMP()                 1518617713           -- Correct unixtime FROM_UNIXTIME(UNIX_TIMESTAMP())  2018-02-14 14:15:13  -- Same as NOW(): OK   In the above everything is fine, except the FROM_UNIXTIME(0) giving 1970-01-01 01:00:00, which is one hour off. If Unix Time 0 were displayed in UTC, it would give 1970-01-01 00:00:00 (or would it?)  This happens if I connect locally or from a remote machine.  To make doubly sure, I checked by coercing to DATETIME. The same happens:  CREATE TEMPORARY TABLE test (N DATETIME, FUX DATETIME, UXT LONG, NN DATETIME); INSERT INTO test SELECT NOW(),FROM_UNIXTIME(0),UNIX_TIMESTAMP(),FROM_UNIXTIME(UNIX_TIMESTAMP()); SELECT * FROM test; +---------------------+---------------------+------------+---------------------+ | N                   | FUX                 | UXT        | NN                  | +---------------------+---------------------+------------+---------------------+ | 2018-02-14 14:19:51 | 1970-01-01 01:00:00 | 1518617991 | 2018-02-14 14:19:51 | +---------------------+---------------------+------------+---------------------+
113557
When using views to display start and end date by default it adds "to" text in between two dates, I was wondering what is the appropriate way to convert "to" to "-" or anything else.  Thanks
56103
I currently have the following function: public String formatForGermany(Datetime targetTime) {     return this.format(targetTime, 'Europe/Berlin'); }  private String format(Datetime targetTime, String zone) {     Integer offset = TimeZone.getTimeZone(zone)             .getOffset(targetTime);     return targetTime.addSeconds(offset / 1000)             .format('HH:mm'); }  This works fine the input value is GMT. However, it seems in some contexts (TBD), Salesforce seems to anticipate this transformation is wanted and does it for me, in which case the offset gets applied twice, with the result that I display (for example) 14:00 instead of 12:00. Is there some way I can check whether the time has already been offset and either not apply it or adjust the offset accordingly?
6955
I'm reading text from a flat file in c# and need to test whether certain values are dates. They could be in either YYYYMMDD format or MM/DD/YY format. What is the simplest way to do this in .Net?