iso8601

Angular2 DatePipe processing ISO 8601 Date (Invalid argument '*' for pipe 'DatePipe')?

房东的猫 提交于 2020-01-03 03:24:12
问题 I've just tried to use a simple date pipe in my angular2 app: Registered: {{user.registered | date:'shortDate'}} The error I get is: Invalid argument '2016-03-28T07:25:40.824Z' for pipe 'DatePipe' in [{{user && user.registered | date:'shortDate' }} in UserDialog@16:57] I do have a User model (minimal here) shared between this component and some others: export class User { public registered: Date; } I get the user data as JSON from backend, and it's a ISO 8601: 2016-03-28T07:26:01.202Z . When

Set default database DateFormat to ISO 8601 with timezones in Laravel

若如初见. 提交于 2020-01-02 05:07:06
问题 I think the title says it: I want to use ISO 8601 with timezones as default DateTime-Format in Laravels Eloquent. I got this class mEloquent extends Eloquent { protected function getDateFormat() { return 'YYYY-MM-DDThh:mm:ss.sTZD'; } } All my models will extend mEloquent. But how should I build the tables? Just <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */

Why does the ISO-8601 specification appear to be universally ignored when it comes to decimals? [closed]

可紊 提交于 2020-01-01 02:33:08
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago . From the ISO-8601:2004(E) Specification: 4.2.2.4 Representations with decimal fraction If necessary for a particular application a decimal fraction of hour, minute or second may be included. If a decimal fraction is included, lower order time elements (if any) shall be

How do I convert 2010-12-15T16:26:49.841-08:00 to a GregorianCalendar in Java? [duplicate]

核能气质少年 提交于 2019-12-30 13:26:51
问题 This question already has answers here : Converting ISO 8601-compliant String to java.util.Date (28 answers) Closed 3 years ago . I have a string date "2010-12-15T16:26:49.841-08:00" and I need to convert it to a GregorianCalendar in Java. How do you do this? Solution from Jesper's answer Code for the solution using joda time: DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ").withOffsetParsed(); DateTime date = formatter.parseDateTime("2010-12-15T16:26:49

How do I convert 2010-12-15T16:26:49.841-08:00 to a GregorianCalendar in Java? [duplicate]

ぐ巨炮叔叔 提交于 2019-12-30 13:26:30
问题 This question already has answers here : Converting ISO 8601-compliant String to java.util.Date (28 answers) Closed 3 years ago . I have a string date "2010-12-15T16:26:49.841-08:00" and I need to convert it to a GregorianCalendar in Java. How do you do this? Solution from Jesper's answer Code for the solution using joda time: DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ").withOffsetParsed(); DateTime date = formatter.parseDateTime("2010-12-15T16:26:49

Java Time's week-of-week-based-year pattern parsing with DateTimeFormatter

帅比萌擦擦* 提交于 2019-12-29 07:56:08
问题 I need to output the current date in the format week-based-year - week-of-week-based-year , i.e. using the ISO week date where the week always starts on a Monday and the first week of the year is the first one that has at least four days in January (so the week with the first Thursday in January). Since 31 December 2015 was a Thursday, the Friday through Sunday, i.e. 1st through 3rd of January 2016, all belong in the 53rd week of 2015 (a "long year"), and the first week of 2016 starts on

How can I store the current timestamp in SQLite as ticks?

百般思念 提交于 2019-12-29 06:46:07
问题 I have a SQLite database where I store the dates as ticks. I am not using the default ISO8601 format. Let's say I have a table defined as follows: CREATE TABLE TestDate (LastModifiedTime DATETIME) Using SQL, I wish to insert the current date and time. If I execute any of the below statements, I end up getting the date and time stored as a string and not in ticks. INSERT INTO TestDate (LastModifiedTime) VALUES(CURRENT_TIMESTAMP) INSERT INTO TestDate (LastModifiedTime) VALUES(DateTime('now')) I

How to convert Python's .isoformat() string back into datetime object [duplicate]

狂风中的少年 提交于 2019-12-29 03:12:13
问题 This question already has answers here : Convert timestamps with offset to datetime obj using strptime (4 answers) How do I parse an ISO 8601-formatted date? (26 answers) Closed 4 years ago . So in Python 3, you can generate an ISO 8601 date with .isoformat(), but you can't convert a string created by isoformat() back into a datetime object because Python's own datetime directives don't match properly. That is, %z = 0500 instead of 05:00 (which is produced by .isoformat()). For example: >>>

Parse ISO 8601 durations

烈酒焚心 提交于 2019-12-29 01:37:14
问题 In ISO 8601, durations are given in the format P[n]Y[n]M[n]DT[n]H[n]M[n]S . Examples: 20 seconds: PT20.0S One year, 2 month, 3 days, 4 hours, 5 minutes, 6 seconds: P1Y2M3DT4H5M6S Question: Given a string that contains a duration in iso 8601 format. I want to obtain the overall number of seconds of that duration. What is the recommended way in standard C++11 to achieve this? Remarks: E.g., there is ptime from_iso_string(std::string) in boost DateTime which does not fit here. Is there a similar

Illegal pattern character 'T' when parsing a date string to java.util.Date

旧巷老猫 提交于 2019-12-27 09:00:07
问题 I have a date string and I want to parse it to normal date use the java Date API,the following is my code: public static void main(String[] args) { String date="2010-10-02T12:23:23Z"; String pattern="yyyy-MM-ddThh:mm:ssZ"; SimpleDateFormat sdf=new SimpleDateFormat(pattern); try { Date d=sdf.parse(date); System.out.println(d.getYear()); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } However I got an exception: java.lang.IllegalArgumentException: