date-format

Format Date as “yyyy-MM-dd'T'HH:mm:ss.SSS'Z'”

若如初见. 提交于 2020-08-21 05:04:49
问题 I need to format a date as yyyy-MM-dd'T'HH:mm:ss.SSS'Z' as specified by Parse's REST API for Facebook. I was wondering what the most lightweight solution to this would be. 回答1: Call the toISOString() method: var dt = new Date("30 July 2010 15:05 UTC"); document.write(dt.toISOString()); // Output: // 2010-07-30T15:05:00.000Z 回答2: toISOString() will return current UTC time only not the current local time. If you want to get the current local time in yyyy-MM-ddTHH:mm:ss.SSSZ format then you

Java json response shows date in numeric value

有些话、适合烂在心里 提交于 2020-08-20 11:47:27
问题 @Data public class Reponse { private String event; @Temporal(TemporalType.TIMESTAMP) private Date eventDate; private Double amount; } Json response is like { event: "transcation', eventDate: 1213123434, amount: 100 } Here, eventDate is showing numeric value 1540317600000 instead of 2018-10-23 回答1: You can annotated the field with @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm") . Then, response time format will be like " yyyy-MM-dd HH:mm " import com.fasterxml

Spark date format issue

限于喜欢 提交于 2020-08-02 05:33:27
问题 I have observed weird behavior in spark date formatting. Actually I need to convert the date yy to yyyy . After date conversion it should be 20yy in date I have tried as below, it failing after 2040 year. import org.apache.spark.sql.functions._ val df= Seq(("06/03/35"),("07/24/40"), ("11/15/43"), ("12/15/12"), ("11/15/20"), ("12/12/22")).toDF("Date") df.withColumn("newdate", from_unixtime(unix_timestamp($"Date", "mm/dd/yy"), "mm/dd/yyyy")).show +--------+----------+ | Date| newdate| +--------

Date format in where clause-Oracle

≯℡__Kan透↙ 提交于 2020-07-08 00:49:30
问题 I have one table where date column is having data in below format: "7/25/2014 12:14:27 AM'. I need to fetch this date by putting in the where clause. can anyone suggest how can i do this? 回答1: Dates (stored in tables) are represented by 7 bytes - they do not have any format associated with them. If they are formatted as a string then that is the client program which you are using to access the database applying its own formatting to the date (which you can usually set via the preferences in

Date format in where clause-Oracle

扶醉桌前 提交于 2020-07-08 00:49:05
问题 I have one table where date column is having data in below format: "7/25/2014 12:14:27 AM'. I need to fetch this date by putting in the where clause. can anyone suggest how can i do this? 回答1: Dates (stored in tables) are represented by 7 bytes - they do not have any format associated with them. If they are formatted as a string then that is the client program which you are using to access the database applying its own formatting to the date (which you can usually set via the preferences in

Date format in where clause-Oracle

大憨熊 提交于 2020-07-08 00:48:52
问题 I have one table where date column is having data in below format: "7/25/2014 12:14:27 AM'. I need to fetch this date by putting in the where clause. can anyone suggest how can i do this? 回答1: Dates (stored in tables) are represented by 7 bytes - they do not have any format associated with them. If they are formatted as a string then that is the client program which you are using to access the database applying its own formatting to the date (which you can usually set via the preferences in

Correct Date format to use for GsonBuilder Date Format

心不动则不痛 提交于 2020-06-27 16:21:23
问题 My client sends me a date in "2019-11-22T16:16:31.0065786+00:00" format. I am getting the following error: java.text.ParseException: Unparseable date: "2019-11-22T16:16:31.0065786+00:00" The date format that I am using is: new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ") .create(); Please let me know which format to use. 回答1: This format can be handled by DateTimeFormatter.ISO_ZONED_DATE_TIME instance of DateTimeFormatter . It is a part of Java Time package which was released

UTC Time Assignment in VBScript

一个人想着一个人 提交于 2020-06-25 08:39:48
问题 Does anyone have a simple means in VBScript to get the current time in UTC? Thanx, Chris 回答1: I use a simple technique Set dateTime = CreateObject("WbemScripting.SWbemDateTime") dateTime.SetVarDate (now()) wscript.echo "Local Time: " & dateTime wscript.echo "UTC Time: " & dateTime.GetVarDate (false) More info on SWbemDateTime If you wanted to convert UTC back to local time do this: Set dateTime = CreateObject("WbemScripting.SWbemDateTime") dateTime.SetVarDate now(),false REM Where now is the

How to format date in hana

佐手、 提交于 2020-05-15 08:36:25
问题 I need to format date in my hana sql, but I don't know how to. Something like this: SELECT DATE_FORMAT(DATAS,'%Y-%m') as Dat ,sum(SALES_VALUE) as Venda ,sum(SALES_QTY) as Qtd ,sum(SALES_VALUE) / sum(SALES_QTY) as Preco FROM looqdata.data_store_sales as s inner join looqdata.data_store_cad as c on s.STORE_CODE = c.STORE_CODE where 1=1 and DATAS between '2016-01-04' and '2016-02-10' and s.STORE_CODE in (1,2) group by DATE_FORMAT(DATAS,'%Y-%m') 回答1: Date-data types in SAP HANA, just as in most

set date format in Gson in jsp

大兔子大兔子 提交于 2020-02-23 07:00:48
问题 I'm using Gson to convert Json to an object in Java. Json that i'm trying to convert has quite complicated structure. { "name": "0", "dtExpiration": "07/14/2011 00:00", "quotaList": null, "question_array": [ { "question": "0", "questionType": "resposta de texto", "min": "null", "max": "null", "responceList": [], "answer_array": [ { ... 1.The question is: will gson.fromJson(json, SuperClass.class) work, as this class has ArrayLists? I can't see if it works, because I have a problem with date