Google Apps Script date format issue (Utilities.formatDate)

The Utilities.formatDate() utility formats a javascript String. However, when written out to the spreadsheet, the new row of data is interpreted by Google Sheets to determine data types and appropriate formatting, just as if you’d typed it in through the user interface. Since you’ve got a recognizable date string, Google Sheets decides it’s a Date, … Read more

VBScript How can I Format Date?

0 = vbGeneralDate – Default. Returns date: mm/dd/yy and time if specified: hh:mm:ss PM/AM. 1 = vbLongDate – Returns date: weekday, monthname, year 2 = vbShortDate – Returns date: mm/dd/yy 3 = vbLongTime – Returns time: hh:mm:ss PM/AM 4 = vbShortTime – Return time: hh:mm d=CDate(“2010-02-16 13:45”) document.write(FormatDateTime(d) & “<br />”) document.write(FormatDateTime(d,1) & “<br />”) … Read more

How to convert ISO Date to UTC date in Hive

Hive understands this format: ‘yyyy-MM-dd HH:mm:ss.SSS’. Use unix_timestamp() to convert to seconds passed from 1970-01-01, then use from_unixtime() to convert to proper format: select from_unixtime(UNIX_TIMESTAMP(“2017-01-01T05:01:10Z”, “yyyy-MM-dd’T’HH:mm:ss’Z'”),”yyyy-MM-dd HH:mm:ss”); Result: 2017-01-01 05:01:10 Update. This method is to remove Z and replace T with space using regexp_replace and convert to timestamp if necessary, without using unix_timestamp(), this will … Read more

Date does not display from Model on HTML input type date

If your using this to generate the browsers HTML5 datepicker implementation, the format of the date needs to be yyyy-MM-dd (ISO format). Using TextBoxFor() it needs to be @Html.TextBoxFor(m => m.InitialDate, “{0:yyyy-MM-dd}”, new { @class = “form-control”, type = “date” }) Alternatively, add the following attributes to the property [DataType(DataType.Date)] [DisplayFormat(DataFormatString = “{0:yyyy-MM-dd}”, ApplyFormatInEditMode = … Read more

Format date as dd/MM/yyyy using pipes

Pipe date format bug fixed in Angular 2.0.0-rc.2, this Pull Request. Now we can do the conventional way: {{valueDate | date: ‘dd/MM/yyyy’}} Examples: Current Version: Example Angular 13 Old Versions: Example Angular 8.x.x Example Angular 7.x Example Angular 6.x Example Angular 4.x Example Angular 2.x More info in documentation DatePipe

group by dates in mongodb

New answer using Mongo aggregation framework After this question was asked and answered, 10gen released Mongodb version 2.2 with an aggregation framework, which is now the better way to do this sort of query. This query is a little challenging because you want to group by date and the values stored are timestamps, so you … Read more