date-formatting

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

两盒软妹~` 提交于 2019-12-10 09:36:53
问题 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 *

Adding vertical line to Date formatted time-series in matplotlib

让人想犯罪 __ 提交于 2019-12-10 09:02:37
问题 I am trying to add a red vertical line to a plot of a timeseries where the x-axis is formatted as %Y-%m-%d. The date at which I would like to add the line is 2013-05-14. Simply adding the line before "plt.show()": plt.axvline(x=2013-05-14) or: plt.axvline(x='2013-05-14') returns the error: RuntimeError: RRuleLocator estimated to generate 23972 ticks from 0044-05-12 23:59:59.999990+00:00 to 2013-06-07 00:00:00.000010+00:00: exceeds Locator.MAXTICKS * 2 (2000) Here is the function, which works

Change Date format in Django model

对着背影说爱祢 提交于 2019-12-09 19:00:52
问题 I have a date field called "birthdate" and property called "lifespan" in a django model. Field birthdate = models.DateField(blank=True, null=True) Property @property def lifespan(self): return '%s - present' % self.birthdate Currently lifespan returns the date in the "yyyy-mm-dd" format. How can I changed this date format to "mm/dd/yyyy"? I know how to do it in a django template with a filter but wanted to see if there was a similar "filter" that I can use in a Django model. I appreciate the

Using awk, how to convert dates to week and quarter?

对着背影说爱祢 提交于 2019-12-08 13:48:11
问题 Using awk, how to convert dates (yyyy-mm-dd) to week and quarter (first day of week set to monday)? Input: a;2016-04-25;10 b;2016-07-25;20 c;2016-10-25;30 d;2017-02-25;40 Wanted output: a;2016-04-25;10;2016-w17;2016-q2 b;2016-07-25;20;2016-w30;2016-q3 c;2016-10-25;30;2016-w43;2016-q4 d;2017-02-25;40;2017-w8;2017-q1 回答1: awk solution: awk -F';' '{ split($2,d,"-"); w = strftime("%W", mktime(d[1]" "d[2]" "d[3]" 00 00 00")); q = int((d[2]+2)/3); print $0,d[1]"-w"w,d[1]"-q"q}' OFS=';' file The

Finding locale date representation in PHP5 [duplicate]

两盒软妹~` 提交于 2019-12-08 09:23:42
问题 This question already has an answer here : Locale date format in PHP5 (1 answer) Closed 6 years ago . my site changes its locale dependent upon either user settings or browser settings (where the user hasn't set their preference). I am using amline charts, the stock chart specifically, which requires the date format in 'MM/DD/YYYY' or 'DD-MM-YYYY', I guess so the chart knows how to understand the dates. There are many ways to format a date dependent upon the computer locale, however I can't

Have Custom formatter for date field in JQGrid

我们两清 提交于 2019-12-07 22:56:33
问题 I want to diplay date on grid as N/A incase it is NULL in the database, or else in normal date format. At present I have this code: name: 'Handshake_Actual_Date', index: 'Handshake_Actual_Date', search: false, editable:true, align: "left", width: 75, formatter: "date", formatoptions: {newformat:"m/d/Y" }, editoptions: { size: 20, dataInit: function (el) { $(el).datepicker({ dateFormat: 'mm/d/yy' }); }, defaultValue: function () { var currentTime = new Date(); var month = parseInt(currentTime

excel vba - How to get the Day Name of Date?

自古美人都是妖i 提交于 2019-12-07 14:28:14
问题 I have a small code that gets the Day Name of the Dates listed in Excel. But the problem is, it's not getting the right Day Name(e.g. Tuesday). For Example: sDayName = Format(Day(11/1/2016), "dddd") Then the output produces an incorrect Day Name which is: sDayName = "Sunday" when it's supposed to be "Tuesday". Thanks for the help guys. 回答1: For your specific request, assuming your date string is formatted as your regional setings: sDayName = Format("11/01/2016", "dddd") If you want the

SQL date conversion results to “invalid number format model parameter.”

戏子无情 提交于 2019-12-07 07:28:57
问题 I have to select some data from Oracle 11g database, but I can't seem to figure out why following select query is failing: SELECT INFO_ID, INFO_DETAIL, IMPORTANT_FLG, DELETE_FLG, CREATE_TIME, DISPLAY_ORDER FROM TABLE_NAME WHERE TO_DATE(TO_CHAR(CREATE_TIME, 'YYYY/MM/DD'), 'YYYY/MM/DD') BETWEEN TO_DATE(TO_CHAR(:fromDate, 'YYYY/MM/DD'), 'YYYY/MM/DD') AND TO_DATE(TO_CHAR(:toDate, 'YYYY/MM/DD'), 'YYYY/MM/DD') ORDER BY IMPORTANT_FLG DESC NULLS LAST , DISPLAY_ORDER ASC NULLS LAST, CREATE_TIME DESC,

Convert number to date sql oracle

房东的猫 提交于 2019-12-07 04:45:13
问题 I'm trying to convert a number ( yyyymmdd ) to date ( mm/dd/yyyy ) For example 20150302 ====> 03/02/2015 回答1: You can try this: select to_date(20150302,'yyyymmdd') from dual; or select to_char(to_date(20150302,'yyyymmdd'),'mm/dd/yyyy') from dual; 回答2: You can use TO_DATE function to convert NUMBER to DATE . Try in following: SELECT TO_DATE(20150302, 'YYYYMMDD') FROM DUAL 回答3: TO_DATE accepts char of CHAR , VARCHAR2 , NCHAR , or NVARCHAR2 datatype and converts into a value of DATE datatype. So

Relative Date Formatting, output for past dates?

大憨熊 提交于 2019-12-07 03:11:06
问题 I am looking at using -[NSDateFormatter setDoesRelativeDateFormatting:] to present dates as "Today" or "Yesterday". I am only looking at dates in the past but am curious what options I would see localised for the UK. Just "Today" "Yesterday" or anything more convoluted like "The day before yesterday" Are the possible outputs listed anywhere so I can get an idea of the screen space needed to correctly display them? 回答1: Yes. They are listed in your console window when you run the following