date-format

Invalid argument 'date format' for pipe 'DatePipe'?

孤人 提交于 2019-12-05 02:29:57
This seems to be a simple question. I'm using pipes in my Ionic 2 application for dates format. This is the recieved webservice reponse. [ { "MessageID": 544882, "CategoryID": 1, "DateSent": "2015-05-18T02:30:56", "Title": "Jobseeker App", "MessageContent": "Hi Test guy just started to use the app..", "Sender": null, "Recipient": null, "DateReceived": null, "DateRead": "2015-05-18T02:30:56", "Note_Direction": "sent", "Viewed": 0, "AppointmentDateTime": null, "MessageAttachments": [ ] }, { "MessageID": 544886, "CategoryID": 1, "DateSent": "2015-05-18T02:42:45", "Title": "Jobseeker App",

How to get yesterday date in node.js backend?

邮差的信 提交于 2019-12-05 01:00:49
问题 I am using date-format package in node back end and I can get today date using var today = dateFormat(new Date()); In the same or some other way I want yesterday date. Still I did't get any proper method. For the time being I am calculating yesterday date manually with lot of code. Is there any other method other then writing manually ? 回答1: Try this: var d = new Date(); // Today! d.setDate(d.getDate() - 1); // Yesterday! 回答2: I would take a look at moment.js if you are interested in doing

How to control SimpleDateFormat parse to 19xx or 20xx?

亡梦爱人 提交于 2019-12-04 22:24:03
Is there a way to parse the following date string as July 23 1916 rather than July 23 2016 ? System.out.println(new SimpleDateFormat("yy/MM/dd", Locale.US).parse("16/07/23")); The Java Doc ( http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html ) says: For parsing with the abbreviated year pattern ("y" or "yy"), SimpleDateFormat must interpret the abbreviated year relative to some century. It does this by adjusting dates to be within 80 years before and 20 years after the time the SimpleDateFormat instance is created . For example, using a pattern of "MM/dd/yy" and a

Javascript convert yyyy-mm-dd hh:mm:ss like newDate(“day, month date year hh:mm:ss”)

删除回忆录丶 提交于 2019-12-04 18:42:28
I want to use Date Object Methods ( getHoures(), getSeconds() ...) on new Date("string") (string = month day, year hh:mm:ss ) but my date format is like this : yyyy-mm-dd hh:mm:ss So I need to convert "yyyy-mm-dd hh:mm:ss" to "( "day, month date year hh:mm:ss" )" How can i do please ? Thx ! Actually, you don't need to perform any such conversion. The string you have is already in very nearly an acceptable format for new Date(string) and in fact even as is will be accepted by most (if not all) modern browsers. To make it fully compliant with the ISO8601 variant that ES5 mandates, just replace

Date validation for Java 8 Time API in Spring

孤街醉人 提交于 2019-12-04 18:25:13
We all know the classic example of a date validation in the controller inside the initBinder method: @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm"); binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true)); } But what is the alternative to support the new Java 8 Time API , where we need to replace DateFormat to DateTimeFormatter ? What tools Spring Framework provides for this? Thanks. The binder.registerCustomEditor method does not support DateTimeFormatter yet but in Spring 4 you can

Google Sitemap Date Format

吃可爱长大的小学妹 提交于 2019-12-04 17:03:55
问题 I need date format for sitemaps in php. How can i do that ? Is this output right ? <lastmod>2012-08-02EEST18:01:18+03:00</lastmod> 回答1: If you have the timestamp you can format the date correctly like this: <lastmod><?php echo date('c', $timestamp); ?></lastmod> Time stamp could be time() (for current time) or some other method of fetching a unix tiemstamp like strtotime() 回答2: To format the current timestamp in W3C Datetime encoding (as used in sitemap.xml files) use the following parameters

PHP date format, remove time and more [duplicate]

谁说我不能喝 提交于 2019-12-04 16:40:55
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Convert one date format into another in PHP Starting from: $date = '2012-09-09 03:09:00' I would like to do two things. Remove the time from the string, so it will become "2012-09-09" . Calculate how many years, days, and hours have passed since this date using the server current date/time/timezone. Could anyone help me figure this out? 回答1: Use DateTime: $date = '2012-09-09 03:09:00'; $createDate = new DateTime

issue with date formatting using NSDateFormatter

半腔热情 提交于 2019-12-04 15:11:30
问题 I have a date string which I want to convert to another format. The original date string example is : "2013-06-04 02:19:21 +0000" I want to convert this to "Wed, Jun 4" NSString * date_string = @"2013-06-04 02:19:21 +0000"; NSDateFormatter *complexdateFormater = [[NSDateFormatter alloc] init]; [complexdateFormater setDateFormat:@"yyyy-M-DD HH:mm:ss Z"]; NSDate* complexdate = [complexdateFormater dateFromString:date_string]; NSString *formatString = [NSDateFormatter dateFormatFromTemplate:@"EE

How to show Persian numbers on ASP.NET MVC page?

允我心安 提交于 2019-12-04 12:22:30
I'm building a site which needs to support both English and Persian language. The site is built with ASP.NET MVC 3 and .NET 4 (C#). All my controllers inherit from a BaseController, which sets culture to "fa-IR" (during test): Thread.CurrentThread.CurrentCulture = new CultureInfo("fa-IR"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR"); In my views, I'm using static helper classes to convert into right timezone and to format date. Like: DateFormatter.ToLocalDateAndTime(model.CreatedOnUtc) I'm doing the same for money with a MoneyFormatter. For money, the currency prints

java local timeformat without year

删除回忆录丶 提交于 2019-12-04 11:39:18
问题 I like to format the local timeformat into a string without the year. At the moment I am able to show the local format containing the year: java.text.DateFormat df = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT); String dateString = df.format(date); therefore i receive an time string output like 12.03.2012 03/12/2012 for the different countries. Now i like to get a short form like 12.03. 03/12 how would i do this? thanks for your help! 回答1: You can use SimpleDateFormat :