date-formatting

Get normal user readable date/time with php

早过忘川 提交于 2019-12-25 00:18:59
问题 I know this question has been asked 2-3 times before, and I am using a function which I found in one of the answers(check it here) from those questions, but it doesnt seem to be working fine for me, i asked there in comments but didnt get any reply, so I am opening a new question here. following is the code to get plain text date/time from a datetime(mysql type). function getElapsedTime($time_stamp) { $ts = convert_datetime($time_stamp); $time_stamp = $ts; $time_difference = strtotime('now')

How to retrieve the Date from Excel with Formula by Apache POI

旧巷老猫 提交于 2019-12-25 00:16:20
问题 I have an Excel Sheet where the Date Cell is assigned with the Date Formula in Excel TODAY() + 1 . So basically today it's showing as 03/10/2018 by default. I've created a code to read the data from Excel which has the formula in it but when I'm getting the date it's coming differently. Code : Cell c = CellUtil.getCell(r, columnIndex); CellType type = c.getCellType(); if (type == CellType.FORMULA) { switch (c.getCachedFormulaResultType()) { case NUMERIC: if (DateUtil.isCellDateFormatted(c)) {

Subset dates in the wrong format in R

喜欢而已 提交于 2019-12-24 18:09:55
问题 I have questionnaire data where participants have inputted their date of birth in a wide variety of formats: ID <- c(101,102,103,104,105,106,107) dob <- c("20/04/2001","29/10/2000","September 1 2012","15/11/00","20.01.1999","April 20th 1999", "04/08/01") df <- data.frame(ID, dob) Before doing any analysis, I need to be able to subset the data when it is not in the correct format (i.e. dd/mm/yr) and then correct each cell in turn manually. I tried using: df$dob <- strptime(dob, "%d/%m/%Y") ...

Date box forced formatting logic

蹲街弑〆低调 提交于 2019-12-24 09:44:54
问题 So I have a program I use that I have become very intrigued by how they force their formatting of a date in a field when input. For example, if I put in "10217", the system would automatically force the field to become 10/02/2017. However, if I put in 1117, then nothing happens as it could be 01/01/2017, 11/17/??, or some other of many combinations. Does anyone know how this forced formatting might be being achieved regarding the logic? Additionally, you can put in a date in the same field

Custom DateTime format

夙愿已清 提交于 2019-12-24 07:18:34
问题 What's the DateTime format "2011-09-12T10:28:55Z" ? How can I get it using ToString()? I didn't get any information in Microsoft's documents about it. Nothing similar like this. 回答1: You can get that using ToString with: var text = date.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'", CultureInfo.InvariantCulture); I don't believe there's a standard date/time format which covers this, unfortunately. Of course, if it's not already a UTC date/time then it'll be lying (that's what the 'Z' bit means). You

PHP Date Export To CSV Format

 ̄綄美尐妖づ 提交于 2019-12-24 07:03:03
问题 After export and when I open the CSV up, you'll notice column L formats only some of the dates properly. This happend on a couple other date columns as well. Is there anything I can do with PHP to ensure all dates are returned properly? Below id my function: public function formatDateCI($date) { // If Birthdate Column if(strlen($date) == 10){ $date = explode('-',$date); $m = $date[0]; $d = $date[1]; $Y = $date[2]; $date = $Y.'-'.$m.'-'.$d; } $date = new DateTime($date); // Final Format 1983

Utilities function in Google App Scripts not working

痴心易碎 提交于 2019-12-24 03:56:15
问题 Function Utilities.formatDate in Google App Scripts is not working correct for date in year 2013 Example- date = Tue Dec 31 2013 18:43:12 GMT+0530 (IST) after formatting it in YYYYMMdd format using code- Utilities.formatDate(date, "IST" ,"YYYYMMdd")) result was- 20**14**1231 In the above result year is expected to be 2013 as per above mentioned date. The same code is working correct for date in 2012 and 2014. 回答1: Just change your pattern from YYYY to yyyy (lower case) and it will work, check

Cell showing Date but not Time

我只是一个虾纸丫 提交于 2019-12-24 00:04:25
问题 In my Excel sheet I added the date and time in one cell as below. At the top (in fx bar) it is showing both the date and time. The problem is, in the cell it is showing only the date but I want both the time and date to be displayed in the cell. Can anyone help me with this? 回答1: Select ColumnB, Home> Cells - Format, Format Cells and under Category: select Custom and in Type: enter dd-mmm-yy hh:mm AM/PM . 回答2: ctrl + ; will show the date, press the space bar, then ctrl + shift + ; will show

Number and date format : altering NLS_SESSION_PARAMETER does not work?

…衆ロ難τιáo~ 提交于 2019-12-23 09:00:43
问题 Oracle 11.2.0.3.0, APEX 4.1.1.00.23. We need to display numbers in our application with the format FM999999999990.000 and dates with the English format DD-MON-YYYY . Even if the application language is going to change (french, spain, etc.), we always need this format for numbers (no space or comma for group separator, and a point for decimal separator, ie. -1254.010 ) and date (3 first letters from the English month name ie. 12-FEB-2012 ). Here are globalization attributes we are using (

Getting wrong data when using SimpleDateFormat.parse()

。_饼干妹妹 提交于 2019-12-23 07:48:59
问题 I am getting the strangest error, when trying to parse a string as a calendar. It seems that it messes up the Date object which I use to set the result calendar's time. The error is pretty inconsistent (or I see no logic in it). Can anyone point out what I might be doing wrong ? public class caltest{ public static final SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd HH:mm:ss.SSS"); public static void main(String[] args) { String date1 = "1992-03-11 12:00:12.123"; String date2 = "1993