date-formatting

What's the simplest way to parse RFC3339 date string in iOS?

梦想与她 提交于 2019-12-05 12:18:30
Youtube API returns date string in RFC3339 format. I found how to parse it on manual, anyway, this is too long. - (NSString *)userVisibleDateTimeStringForRFC3339DateTimeString:(NSString *)rfc3339DateTimeString // Returns a user-visible date time string that corresponds to the // specified RFC 3339 date time string. Note that this does not handle // all possible RFC 3339 date time strings, just one of the most common // styles. { NSString * userVisibleDateTimeString; NSDateFormatter * rfc3339DateFormatter; NSLocale * enUSPOSIXLocale; NSDate * date; NSDateFormatter * userVisibleDateFormatter;

Format column within dplyr chain

偶尔善良 提交于 2019-12-05 11:41:44
问题 I have this data set: dat <- structure(list(date = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L), .Label = c("3/31/2014", "4/1/2014", "4/2/2014", "4/3/2014"), class = "factor"), site = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L), .Label = c("a", "b"), class = "factor"), clicks = c(73L, 64L, 80L, 58L, 58L, 61L, 70L, 60L, 84L, 65L, 77L), impressions = c(55817L, 78027L, 77017L, 68797L, 92437L, 94259L, 88418L, 55420L, 69866L, 86767L, 92088L)), .Names = c("date", "site",

Convert number to date sql oracle

纵饮孤独 提交于 2019-12-05 08:21:55
I'm trying to convert a number ( yyyymmdd ) to date ( mm/dd/yyyy ) For example 20150302 ====> 03/02/2015 You can try this: select to_date(20150302,'yyyymmdd') from dual; or select to_char(to_date(20150302,'yyyymmdd'),'mm/dd/yyyy') from dual; You can use TO_DATE function to convert NUMBER to DATE . Try in following: SELECT TO_DATE(20150302, 'YYYYMMDD') FROM DUAL TO_DATE accepts char of CHAR , VARCHAR2 , NCHAR , or NVARCHAR2 datatype and converts into a value of DATE datatype. So, convert the number into string, and apply to_date. You could use single-quotation marks around the number to convert

Error: Attempted to call method “format” on null context object

跟風遠走 提交于 2019-12-05 05:58:41
Spring-boot v1.4.1 Java v1.8 Thymeleaf v2.1.5. The following line of code in my view: <td th:each = "sprint : ${sprints}" th:text = "${sprint.releaseDate} ? ${#temporals.format(sprint.releaseDate, 'MMM/dd/yyyy')}"></td> which has syntax I am basing off of the S.O. question SpringBoot Thymeleaf Ordinal Numbers , produces the error: org.springframework.expression.spel.SpelEvaluationException: EL1011E:(pos 11): Method call: Attempted to call method format(java.time.LocalDate,java.lang.String) on null context object However, if I run this line of code without the Thymeleaf formatting it works and

Making a PHP/MySQL Timestamp look more attractive

烂漫一生 提交于 2019-12-04 19:10:52
So basically, I'm currently selecting a Timestamp from my MySQL database. In the database, the timestamp looks like so: 2010-06-30 12:36:08 Obviously for a webapp, that's not very attractive for users to view. So, using some CodeIgniter functions, I made it look a bit nicer. <h4 class="timestamp"> <?php // Quickly calculate the timespan $post_date = mysql_to_unix($row->date); $now = time(); echo timespan($post_date, $now);?> ago </h4> If you don't do CodeIgniter, everything's standard PHP except for echo timespan() . CodeIgniter just echoes it as an 'English' timespan. So, an example output

D3 time and date histogram

社会主义新天地 提交于 2019-12-04 17:15:54
I'm attempting to make a histogram using primarily time and date data, provided in a json file (along with other info) in this format: 2014-03-01 00:18:00. I've looked at http://bl.ocks.org/mbostock/3048450 as an example, but I haven't managed to crack it. The key part seems to be this: var data = d3.layout.histogram() .bins(x.ticks(20)) (dataset.timestamp); When I view my code in the browser it gives "TypeError: data is undefined", and refers to d3.v3.js line 5878. Assuming I fix that error, the next place it may stumble is the axis formatting: var formatDate = d3.time.format("%y-%m-%d %h:%m:

date format dd/MM/yyyy not working in asp.net mvc 5

Deadly 提交于 2019-12-04 14:41:06
I'm developing an asp.net mvc 5 application, in which I'm trying to set a validation for dd/MM/yyyy format, I've been struggling a lot to find an appropriate solution but no success, what I want it to accept: 24/01/2016 but it displays validation message as : The field JoiningDate must be a date. Here is what I've tried : [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)] public DateTime JoiningDate { get; set; } Also, I want it to display the date in dd/MM/yyyy format everywhere at the user's end but this is a second part of my question, firstly, it should at

Setting Time in Excel using POI

試著忘記壹切 提交于 2019-12-04 13:45:40
问题 I am trying to create an Excel Work sheet using POI api in Java. In that Excel Work Sheet I want to have a cell with TIME alone. By setting this we can include the cell in summation of that particuluar column as we do in number columns. For this we need to format the cell as Time >> 13:30:55. (The internal format is 'h:mm:ss;@' ). And we need to remove the date part from the cell. When I read the cell the cell value using the POI, it is returning as 'Sun Dec 31 01:00:00 IST 1899' ( When i set

Excel TEXT formula doesn't convert 'yyyy' to a year

☆樱花仙子☆ 提交于 2019-12-04 02:17:17
I want to combine some text with a date in Excel 2013. Let's say I have a cell A2 with a date like 30-10-2014 . I tried to append the date after the text with this formula: ="Some text and a date: "&A2 But the output shows the date as a number: Some text and a date: 41942 So I tried it with the TEXT formula: ="Some text and a date: "&TEXT(A2;"dd-mm-yyyy") But this shows Some text and a date: 30-10-yyyy and not Some text and a date: 30-10-2014 So or I do not understand how the TEXT formula works or is there some bug / issue here? UPDATE : It looks like it's important that I have a Dutch version

In SQL Server, how to convert a date to a string in format M/D/YYYY? (no leading zeros, not MM/DD/YYYY)

社会主义新天地 提交于 2019-12-04 01:29:20
Right now, my code has the following conversion for a date field: convert(varchar, Citation.PublishedOn, 101) However, that returns dates like 03/01/2010. The request was to have the dates display as 3/1/2010 (without the leading zeros, but with a 4 digit year). I've looked at http://msdn.microsoft.com/en-us/library/ms187928.aspx and I'm not seeing anything that explicitly excludes leading zeros. How do I format the date to exclude leading zeros? This is how I would do it: DECLARE @dt datetime SET @dt= Citation.PublishedOn SELECT LTRIM(STR(MONTH(@dt)))+'/'+LTRIM(STR(DAY(@dt)))+'/'+STR(YEAR(@dt