date-formatting

sqlite change date format of every cell in column

做~自己de王妃 提交于 2019-12-20 05:11:31
问题 I have a table with a large number of rows. One column contains dates in the format '%m/%d/%Y' and I want to change all of them to format '%Y-%m-%d' the usual: update table set mydate = '6' doesn't work I guess because the date is always changing. How would I do that in this case? 回答1: If the fields in the date string are properly padded with zeros, you can extract them as substrings: UPDATE MyTable SET MyDate = substr(MyDate, 7, 4) || '-' || substr(MyDate, 1, 2) || '-' || substr(MyDate, 4, 2

Format date in <f:selectItem(s) itemLabel> using DateTimeConverter

我的未来我决定 提交于 2019-12-20 04:58:34
问题 I have a <h:selectOneMenu> that has <f:selectItems> with CategoryHistory objects loaded in it. I only show the Date date field as itemLabel . That works but I want to format the date: I created a converter that extends javax.faces.convert.DateTimeConverter and change the fields in the constructor. But my dates only show in default format :( DateAndTimeConverter.java import javax.faces.bean.ManagedBean; import javax.faces.convert.Converter; import javax.faces.convert.DateTimeConverter; import

generically parsing String to date

不羁的心 提交于 2019-12-20 04:12:26
问题 I'm communication with a web service and it the json response has dates in it. the problem is those dates are in different formats. is there a generic way to parse these strings? 回答1: You should probably have an ordered list of formats to try (ideally using Joda Time as a far better API than the built-in one) and try each in turn until one works. It's not ideal in terms of performance (all the exceptions for failure) but it'll work and should be reasonably clear. Of course, if you can get in

Encountering SQL Error: ORA-01843: not a valid month

坚强是说给别人听的谎言 提交于 2019-12-20 03:21:32
问题 I created a table using this query CREATE TABLE Store (id number(11) primary key not null, opening_time timestamp CHECK (EXTRACT(HOUR FROM opening_time) > 8 || NULL)); Now, when I try to insert some data using insert into Store values(1, '04/04/2012 13:35 PM'); , I encounter this error SQL Error: ORA-01843: not a valid month . What is it that I am doing wrong ? 回答1: '04/04/2012 13:35 PM' is not a date - it is a string. Oracle will do an implicit TO_DATE( string_value, format_mask ) on non

Format code for a date with time zone in excel

妖精的绣舞 提交于 2019-12-19 17:28:10
问题 I have date value with a time zone. 24 Nov 2005 GMT+05:30 What is the format code for this custom format in Excel? I tried dd MMM yyyy with z , zz , zzz , and Z but Excel ignores those options. 回答1: Not sure if possible. I've just gone through every letter in custom format cell and nothing looked right. What I would suggest is maybe splitting it up into a few cells and then bringing them all together. In the first column (A1) you could have the date, formatted how you like (dd mmm yyyy).

Format code for a date with time zone in excel

隐身守侯 提交于 2019-12-19 17:28:09
问题 I have date value with a time zone. 24 Nov 2005 GMT+05:30 What is the format code for this custom format in Excel? I tried dd MMM yyyy with z , zz , zzz , and Z but Excel ignores those options. 回答1: Not sure if possible. I've just gone through every letter in custom format cell and nothing looked right. What I would suggest is maybe splitting it up into a few cells and then bringing them all together. In the first column (A1) you could have the date, formatted how you like (dd mmm yyyy).

Using IW and MM in Oracle

青春壹個敷衍的年華 提交于 2019-12-19 12:05:41
问题 I'm using IW for weekly result and MM for Monthly result. But I always get an error: ORA-00979: not a GROUP BY expression 00979. 00000 - "not a GROUP BY expression" My queries are these (Weekly) SELECT 'Data' || ',' || TO_CHAR(d.dtime_day, 'MM/dd/yyyy') || ',' || NVL(o.cnt_opened, 0) --as cnt_opened || ',' || NVL(c.cnt_closed, 0) --as cnt_closed FROM owner_dwh.dc_date d LEFT JOIN ( SELECT TRUNC(t.create_time, 'IW') AS report_date, count(*) AS cnt_opened FROM app_account.otrs_ticket t WHERE t

Formatting dates in PostgreSQL

谁说我不能喝 提交于 2019-12-19 10:32:44
问题 I have a field which its format is date with time as: YYYY-MM-DD HH-MM-SS for example: 2000-08-12 00:00:00 I want to get just the date part and change its format to DD/MMM/YYYY for example the expected result of the previous example will be: 12/Aug/2000 The field definition is: Ddate timestamp without time zone DEFAULT now() I read the whole page of Date/Time Functions and Operators and other sources as well but I couldn't find any information that is helpful. 回答1: You can use the to_char

Human-readable, current time sensitive date and time formatting in PHP

匆匆过客 提交于 2019-12-19 10:30:35
问题 Is there a painless way to convert unix timestamps, MySQL timestamps, MySQL datetimes (or any other standard date and time format) into strings in the following form: Today, 6:00pm Tomorrow, 12:30pm Wednesday, 4:00pm Next friday, 11:00am I'm not sure what to call these - I guess conversational-style, current time sensitive date formats? 回答1: As best I can tell, there is no native function for this. I have created (the start of) a function to do what you are wanting. function timeToString(

Human-readable, current time sensitive date and time formatting in PHP

谁说我不能喝 提交于 2019-12-19 10:30:03
问题 Is there a painless way to convert unix timestamps, MySQL timestamps, MySQL datetimes (or any other standard date and time format) into strings in the following form: Today, 6:00pm Tomorrow, 12:30pm Wednesday, 4:00pm Next friday, 11:00am I'm not sure what to call these - I guess conversational-style, current time sensitive date formats? 回答1: As best I can tell, there is no native function for this. I have created (the start of) a function to do what you are wanting. function timeToString(