iso8601

What determines (how to configure) what format string is used by php PDO driver for values of date and timestamp fields?

倖福魔咒の 提交于 2019-12-24 23:04:07
问题 I have Firebird 3.0 database which have date and timestamp fields and I am using interbase extension (yes - still interbase) and Yii2 framwork in PHP 7.x. And I have Yii code: Yii::$app->db->createCommand('select order_date from orders where order_id=5'); which returns field with value: 2019-10-15 00:00:00 AFAIU then Yii2 uses PDO and that is why my question reduces to the question about PDO. PHP has DateTime extension but AFAIU PDO does not use DateTime class (and also does not use Unix

Get week number of the month from date (weeks starting on Mondays)

丶灬走出姿态 提交于 2019-12-24 13:28:49
问题 I have to find week number of the month from given date using JavaScript. Week start is Monday. I have tried the code below but not getting accurate result. function getWeekNumber(date) { var monthStartDate = new Date(new Date().getFullYear(), new Date().getMonth(), 1); monthStartDate = new Date(monthStartDate); var day = monthStartDate.getDay(); date = new Date(date); var date = date.getDate(); let weekNumber = Math.ceil((date + (day)) / 7); return (weekNumber == 0) ? 1 : weekNumber; } var

ISO 8601 week number in C

徘徊边缘 提交于 2019-12-24 02:14:25
问题 I am trying to get the ISO8601 week number with C. MinGW is installed on my PC. GCC version is 5.3.0. You can see my code below. strftime doesn't work for specifier "%V". But it works fine with the specifier "%W". But that's not what I want. I need the week number of year in ISO 8601 format. I have tried my code with 2 different online C compilers and they both worked fine. I doubt that the compiler on my PC is not well configured. Can anyone tell me what am I doing wrong? Any help would be

Is it possible to represent and open-ended time interval with ISO 8601?

拜拜、爱过 提交于 2019-12-23 19:42:50
问题 ISO 8601 includes a few ways to represent time intervals: start/end start/duration duration/end duration For example, 1990/1999 is an interval including all of the 1990s. But what if I have an open-ended range of dates, e.g. "before 1970" or "after 1900"? Can these be represented with ISO 8601? 回答1: Short answer related to current state: No, it is up to you how you interprete the end marker of an interval. The actual valid ISO-8601-version is silent about open or closed interval boundaries.

Get week number using date in python

六眼飞鱼酱① 提交于 2019-12-22 22:40:40
问题 Date is datetime.date(2013, 12, 30) I am trying to get week number using import datetime datetime.date(2013, 12, 30).isocalendar()[1] I am getting output as , 1 Why i am not getting week number of last year , instead i am getting week number of current year? Whats wrong i am doing here ? 回答1: You are doing nothing wrong, 2013/12/30 falls in week 1 of 2014, according to the ISO8601 week numbering standard: The ISO 8601 definition for week 01 is the week with the year's first Thursday in it.

Ebay API ISO 8601 duration format to timestamp

时间秒杀一切 提交于 2019-12-22 09:29:12
问题 Ebay API provides me time in ISO 8601. For example, it gives me item time left: P0DT0H1M4S Here is how this time is formatted: ebay duration I want to convert this time to simple Y-m-d H:i:s format. So far I've tried date("Y-m-d", strtotime("P0DT0H1M4S")); but it does not work. 回答1: That date interval string is an ISO 8601 duration specification and can be use with DateTime() and DateInterval() $date = new DateTime(); $date->add(new DateInterval('P0DT0H1M4S')); echo $date->format('Y-m-d H:i:s

RFC822 Timezone Parsing in Java

梦想的初衷 提交于 2019-12-22 04:42:45
问题 I have a JS date that is being converted by Dojo into RFC822 format. The function call - dojo.date.toRfc3339(jsDate), generates the following date - 2007-02-26T20:15:00+02:00. I have an application that uses a Java date SimpleDateFormat to parse in the dates generated above. I am having problems parsing this date format due to the timezone. I have attempted to use yyyy-mm-DD'T'hh:mm:ssZ This fails as the 'Z' for timezone doesn't expect a ':' character. Does anyone know how I would specify a

PHP - format date ISO8601?

北战南征 提交于 2019-12-21 14:04:21
问题 I have a year (2002) and I'm trying to get it into the following format: 2002-00-00T00:00:00 I tried various iterations, the last of which was this: $testdate = DateTime::createFromFormat(DateTime::ISO8601, date("c")) echo date_format($testdate, '2002'); But, even if I come close, it always seems to add +00:00 to the end of it... 回答1: The 'c' format in PHP always appends the timezone offset. You can't avoid that. But you can build the date yourself from components: date('Y-m-d\TH:i:s',

ISO 8601 Timestamp for MySQL Database: MySQL Incorrect datetime value

允我心安 提交于 2019-12-21 13:02:44
问题 Error log: { [Error: Incorrect datetime value: '2012-08-24T17:29:11.683Z' for column 'robot _refreshed_at' at row 1] number: 1292, sqlStateMarker: '#', sqlState: '22007', message: 'Incorrect datetime value: \'2012-08-24T17:29:11.683Z\' for column \' robot_refreshed_at\' at row 1', sql: 'INSERT INTO users (id,name,count_moments,count_likes,count_followers,rob ot_refreshed_at,robot_count_followers) VALUES (\'1834084\',\'NNNyingzi\',\'5\',\ '0\',\'0\',\'2012-08-24T17:29:11.683Z\',\'0\')',

PHP Datetime fail to convert negative ISO8601 date

空扰寡人 提交于 2019-12-21 02:41:33
问题 Converting a negative date with DateTime get me false Test code var_dump(\DateTime::createFromFormat(\DateTime::ISO8601, '-0001-11-30T00:00:00+0100')); Result boolean false Expected result object(DateTime)[5] public 'date' => string '-0001-11-30 00:00:00' (length=20) public 'timezone_type' => int 1 public 'timezone' => string '+01:00' (length=6) (or something similar) P.S. The negative date string was created with $d->format(\DateTime::ISO8601); PHP version PHP 5.4.28 回答1: According to manual