format

How to convert string to date without time in Swift 3?

孤者浪人 提交于 2020-01-03 18:58:10
问题 I have try to convert the date like 2017-02-11 string to date but the result give me back something like this 2017-02-10 16:00:00 +0000 . I am using the following code below. let localDate = dateFormatter.string(from: date) //2017-02-11 let dateFormatter2 = DateFormatter() dateFormatter2.dateFormat = "yyyy-MM-dd" let selectedDate = dateFormatter2.date(from: localDate) print("Did Select \(selectedDate)") // 2017-02-10 16:00:00 +0000 回答1: let dateWithTime = Date() let dateFormatter =

Converting seconds to human readable format MM:SS Java [duplicate]

跟風遠走 提交于 2020-01-03 18:37:31
问题 This question already has answers here : Formatting seconds and minutes (4 answers) Closed 5 years ago . How can I convert a long int of seconds to the human readable format MM:SS Only SS should be 0 padded so long = 67 -> 1:07 回答1: String readable = String.format("%d:%02d", s/60, s%60); 回答2: Use integer division by 60 to turn seconds in to whole minutes. The Modulus(%) of seconds by 60 will give the "leftover" seconds. Then use a string conversion to check for the necessity of 0 padding. int

Converting seconds to human readable format MM:SS Java [duplicate]

孤者浪人 提交于 2020-01-03 18:36:40
问题 This question already has answers here : Formatting seconds and minutes (4 answers) Closed 5 years ago . How can I convert a long int of seconds to the human readable format MM:SS Only SS should be 0 padded so long = 67 -> 1:07 回答1: String readable = String.format("%d:%02d", s/60, s%60); 回答2: Use integer division by 60 to turn seconds in to whole minutes. The Modulus(%) of seconds by 60 will give the "leftover" seconds. Then use a string conversion to check for the necessity of 0 padding. int

Smart printing of integers in fortran90

你说的曾经没有我的故事 提交于 2020-01-03 11:25:12
问题 I'm learning Fortran90 after a brief introduction to Fortran77 a few years ago. When printing integers in Fortran, you must specify how many spaces you want to reserve for printing the integer. Consider this program... implicit none integer :: i i = 123 write(*, '(A, I3, A)') "'", i, "'" !3 spaces for output = no padding write(*, '(A, I5, A)') "'", i, "'" !5 is too many, so output is padded write(*, '(A, I2, A)') "'", i, "'" !2 is too few, so output is jibberish write(*, '(A, I:, A)') "'", i,

Smart printing of integers in fortran90

戏子无情 提交于 2020-01-03 11:25:07
问题 I'm learning Fortran90 after a brief introduction to Fortran77 a few years ago. When printing integers in Fortran, you must specify how many spaces you want to reserve for printing the integer. Consider this program... implicit none integer :: i i = 123 write(*, '(A, I3, A)') "'", i, "'" !3 spaces for output = no padding write(*, '(A, I5, A)') "'", i, "'" !5 is too many, so output is padded write(*, '(A, I2, A)') "'", i, "'" !2 is too few, so output is jibberish write(*, '(A, I:, A)') "'", i,

Vertical align floats on decimal dot

蓝咒 提交于 2020-01-03 07:19:12
问题 Is there a simple way to align on the decimal dot a column of floats? In other words, I would like an output like the one of (vertical bars '|' are there only for clarity purpose) (format t "~{|~16,5f|~%~}" '(798573.467 434.543543 2.435 34443.5)) which is | 798573.44000| | 434.54355| | 2.43500| | 34443.50000| but with trailing spaces instead of zeros, as follows: | 798573.44 | | 434.54355| | 2.435 | | 34443.5 | 回答1: I do not think that this can easily be done with format 's inbuilt control

Get one letter abbreviation of week day of a date in java

こ雲淡風輕ζ 提交于 2020-01-03 06:49:30
问题 As far I know, in Java I can get weekdays in normal (Friday) or short mode (Fri). But, there is any way to obtain only first letter? I thought I can get first letter using "substring", but it won't be correct for all languages. For example, spanish weekdays are: Lunes, Martes, Miércoles, Jueves, Viernes, Sábado and Domingo, and first letter for "Miércoles" is X instead of M to difference it from "Martes". 回答1: In Android you can use SimpleDateFormat with "EEEEE". In the next example you can

amCharts width field and parsing dates

帅比萌擦擦* 提交于 2020-01-03 05:27:08
问题 I have a serial chart in amCharts. I need to set parse dates to false, but this pushes all of the data toward the left side of the graph (leaving the right half blank). If I set the Width field to Category (x axis), fixing the pushed data, the data appearance colors become too wide. I tried changing some of the formatting, but these changes did not seem to have any effect { "type": "serial", "categoryField": "Category", "dataDateFormat": "", "autoMarginOffset": 40, "marginRight": 60,

What is this timestamp format: 090912154113?

让人想犯罪 __ 提交于 2020-01-03 03:40:15
问题 What kind of timestamp is this : 090912154113 more : 082712032309 122711190042 091112090931 it looks like the regular unix time but with different format, what is it and how to do it using php ? 回答1: Looks like 9th September 2012 at 3(15 in 24hr format):41 and 13 seconds (mmddyyhhmmss). http://php.net/manual/en/function.date.php, mdyHis using php formatting. 回答2: it seems to be: MMDDYYHHmmSS. 来源: https://stackoverflow.com/questions/12769165/what-is-this-timestamp-format-090912154113

How to unformat xml file

…衆ロ難τιáo~ 提交于 2020-01-03 03:37:09
问题 I have a method which returns a String with a formatted xml. The method reads the xml from a file on the server and parses it into the string: Esentially what the method currently does is: private ServletConfig config; InputStream xmlIn = null ; xmlIn = config.getServletContext().getResourceAsStream(filename + ".xml") ; String xml = IOUtils.toString(xmlIn); IOUtils.closeQuietly(xmlIn); return xml; What I need to do is add a new input argument, and based on that value, continue returning the