format

Change a string in xml into an array in xml easily

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 03:18:47
问题 I was wondering if anyone knew if there was a simple way to change all of my strings in my xml file to arrays? Example: //This is the string I need to change: <string name="sample1">value1, value2, value3, value4, value5</string> //This is the way I need it to be: <array name="sample1"> <item>value1</item> <item>value2</item> <item>value3</item> <item>value4</item> <item>value5</item> </array> My problem is not that I do not know how to manually do it. But I am looking for a way to simulate

.NET datepicker format gives “MM-dd-yyyy” instead of “MM/dd/yyyy”

强颜欢笑 提交于 2019-12-11 03:17:36
问题 I have created a datepicker in my MVC that works fine but when i pick a date I get the format "MM/dd/yyyy". When I save that, it changes back to "MM-dd-yyyy". If i try to save with this format the datepicker says that it is not a valid date because it has changed the seperater from "/" to "-". So I wish to maintain a format like this "MM/dd/yyyy". Here is my code for the field where the datepicker is implemented: @Html.ValidationSummary(true) @Html.HiddenFor(model => model.Id) <div class=

Objective C / iPhone: How do I extract the actual unicode date format strings for the current region?

别来无恙 提交于 2019-12-11 03:14:25
问题 According to this site: http://iosdevelopertips.com/cocoa/date-formatter-examples.html there is a class that handles formatting, which takes in a set of constants/enums (e.g. NSDateFormatterShortStyle) to the "setDateStyle" property/method. Somehow the NSDateFormatter knows to retrieve the proper locale-specific date format. What I want is to be able to retrieve the default formats based on the user's choice of region format. I have a feeling it is stored in NSLocale, but that does not seem

Formatting numbers from 1000 to 10.00

自作多情 提交于 2019-12-11 02:35:54
问题 I'll like to format 1000 to 10.00 The PHP number_format function does not seem to be working for this. I have tried: $amount2 = number_format("$cost",2,"",","); echo "$cost"; Any ideas? Is there a way I can manupulate number_format to display the results (i.e just inserting a decimal before the last two digits? 回答1: Number format will change the "." to a "," but you telling it to format ONE THOUSAND. $cost=1000; echo number_format($cost,2,'.',','); //1,000.00 What you want is simply: $cost

Select List of Column Names / Aliases from Custom Sub-Query

淺唱寂寞╮ 提交于 2019-12-11 02:27:19
问题 In Oracle, is there a way to select all the columns that are returned from a custom query with aliases? As an example, let's say we have a query as the following: SELECT FIRST_NAME AS COL1, LAST_NAME AS COL2, ADDRESS AS COL3 FROM PEOPLE I would like to know if an encapsulating query can be made that would return: COL1 COL2 COL3 回答1: Here is how to do it in PL/SQL. Don't know if it is possible with straight oracle SQL only. You could always encapulate it in some kind of function if needed.

Java date - 12am is stored as 24?

…衆ロ難τιáo~ 提交于 2019-12-11 01:52:58
问题 So me and my partner have been working on this project for a while now. We work with dates A LOT in this project, and we recently noticed an issue, and we are rather deep in at this point. We store our times in SQLlite (Android project) as a formatted string, since a lot of the time they are directly bound to listviews and such. The problem we noticed, which i found kind of odd, is that that SimpleDateTimeFormat object, when used to format to 24h time (its a medical based project, so 24h time

Converting Julian date to Java date but still cannot get Month

限于喜欢 提交于 2019-12-11 01:47:45
问题 I am trying to get day ,month and year from a Julian date. String date = "13136";//Julian date Date convertedDate = new SimpleDateFormat("yyDDD").parse(date); System.out.println(convertedDate); It prints Thu May 16 00:00:00 BST 2013 which is correct. Now I want to get Day , Month and Year from it Calendar cal = Calendar.getInstance(); cal.setTime(convertedDate); System.out.println(cal.get(Calendar.MONTH)); It prints 4 . It should print 5 instead of 4 . Why is it not printing as correct ? What

How to format date to 1900's?

落爺英雄遲暮 提交于 2019-12-11 01:43:34
问题 I'm preprocessing data and one column represents dates such as '6/1/51' I'm trying to convert the string to a date object and so far what I have is: date = row[2].strip() format = "%m/%d/%y" datetime_object = datetime.strptime(date, format) date_object = datetime_object.date() print(date_object) print(type(date_object)) The problem I'm facing is changing 2051 to 1951. I tried writing format = "%m/%d/19%y" But it gives me a ValueError. ValueError: time data '6/1/51' does not match format '%m/

Symfony YAML format conversion

时光怂恿深爱的人放手 提交于 2019-12-11 01:39:34
问题 I have some service definition that looks like this: MyService: class: Some\Class\Here factory: - SomeFactoryHere - method calls: - [add, ["@=service('AnotherService1').create(service('AnotherService2'), service('AnotherService3'), service('AnotherService3'))"]] IMHO, this can be more readable if converted to something like this: MyService: class: Some\Class\Here factory: - SomeFactoryHere - method calls: - add, "@=service('AnotherService1').create( service('AnotherService2'), service(

Two CalendarExtenders?

你离开我真会死。 提交于 2019-12-11 01:08:57
问题 I have a popup ajax calendarextender that populates a text box with the selected date, (MM/dd/yyyy). This works. I want to capture the same date in an additional text box with a different format (yyyyMMdd). The first is for display and the second date is a parameter for gridview query. Is this done with two calandarextenders? (btw I'm using C#) 回答1: If you are supplying one to a query, you could just change the parameter value in code before supplying it to the query. var datetimeForQuery =