date-conversion

Timestamp to ISO 8601 in Lua

ⅰ亾dé卋堺 提交于 2019-12-12 10:32:01
问题 How would you convert a timestamp to an ISO 8601 format (such as 2009-01-28T21:49:59.000Z ) in Lua? I'm specifically trying to do it by using the HttpLuaModule in Nginx. 回答1: Try os.date("!%Y-%m-%dT%TZ") or os.date("!%Y-%m-%dT%TZ",t) if t has the date in seconds since the epoch. 回答2: Or you can use: local now_date_time = os.date("!%Y%m%dT%H%M%S") --> For date_time: 20191015T042028Z local now_date = os.date("!%Y%m%d") --> For only date: 20191015 来源: https://stackoverflow.com/questions/20131891

Date conversion without specifying the format

匆匆过客 提交于 2019-12-11 08:08:36
问题 I do not understand how the "ymd" function from the library "lubridate" works in R. I am trying to build a feature which converts the date correctly without having to specify the format. I am checking for the minimum number of NA's occurring as a result of dmy(), mdy() and ymd() functions. So ymd() is giving NA sometimes and sometimes not for the same Date value. Are there any other functions or packages in R, which will help me get over this problem. > data$DTTM[1:5] [1] "4-Sep-06" "27-Oct

Convert String to date (european to american) [duplicate]

[亡魂溺海] 提交于 2019-12-11 07:34:54
问题 This question already has answers here : Convert one date format into another in PHP (15 answers) Closed 2 years ago . I have a String on the form: "dd/mm-yyyy", where dd is day of the month with two digits, mm is the month represented with two digits, and yyyy is the year with four digits. I need to store this in my database. Ive tried $dato = date('d/m-Y' ,strtotime($_POST['dag'] ) But that clearly doesnt work. In my database the date displays as yyyy-mm-dd. How do I properly convert the

How can I convert a string in the format “YYYYMM” to “MMMYY”?

谁说我不能喝 提交于 2019-12-11 04:33:14
问题 I want to pass values in YYYYMM format such as "201509" to a function and retrieve the human-friendlier "MMMYY" format, such as "Sep 2015". I thought this might work: internal static string GetMMMYYFromYYYYMM(String YYYYMMVal) { string intermediateStr = YYYYMMVal + "01"; DateTime intermediateDate = Convert.ToDateTime(intermediateStr); return intermediateDate.ToString("MMMyy"); } ...but no, it crashes with " String was not recognized as a valid DateTime " ISTM that the YYYYMMDD format should

how to vb.net date save to mysql date with no 0000-00-00

陌路散爱 提交于 2019-12-11 04:07:02
问题 I've been killing brain cell for over 5 hours with this question. how to properly save a date from vb.net to mysql date without getting the 0000-00-00all the time. I have tried multiple suggestions where you format the date value before entering but it gets me the same result ex: Dim departDate As Date Dim d As String = Format(departDate, "05/05/2007") in which i tested and didnt works i still got the 0000-00-00 I've tried: Dim changeFormatDate As Date Dim AddFechaListadoCasas2 as String

Android parseException unparseable date in specific devices?

徘徊边缘 提交于 2019-12-11 02:04:02
问题 In my android App I am converting a string to a date using the following method public Date convertToDate(String date) { //(input date format "Feb 18, 2013 01:32 AM") DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT); try { Date dateObj = dateFormat.parse(date); return dateObj; } catch (ParseException e) { e.printStackTrace(); } catch (Exception e) { Log.d("Utility", e.getMessage()); } return null; } It works fine in most of the mobile but for some

SUM of Duration based on the DateTime that needs to be updated in previous Half hour interval

坚强是说给别人听的谎言 提交于 2019-12-10 12:19:55
问题 I searched several questions but that all are not exactly answering my question. Hence raised this question here. I have a table say 'Table' that has has DateTime,ID, Code and Duration are the columns. DateTime will be having data as '2017-12-12 00:30:00','2017-12-12 00:30:37' etc and I need to SUM the duration column based on this Interval date. If DateTime is '2017-12-12 00:30:00' then our query should sum all the data between '2017-12-12 00:00:00' to '2017-12-12 00:30:00' and show it in

python - ValueError: time data does not match format

与世无争的帅哥 提交于 2019-12-10 12:05:53
问题 I downloaded my CSV file TSLA.csv from here. It has a header line and 7 columns, first of which is date, the others are floats and ints. I want to be able to get a numpy array out of it: import csv import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates import urllib def bytespdate2num(fmt, encoding="utf-8"): strconverter = mdates.strpdate2num(fmt) def bytesconverter(b): s = b.decode(encoding) return strconverter(s) return bytesconverter with open("TSLA.CSV", "r")

JAVA Date Conversion

試著忘記壹切 提交于 2019-12-08 05:22:33
问题 How can I convert Wed Apr 27 17:53:48 PKT 2011 to Apr 27, 2011 5:53:48 PM. 回答1: new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a.").format(yourDate); 回答2: You can use SimpleDateFormat or JodaTime's parser. However it might be simple enough to write your own String parser as you are just rearranging fields. 回答3: You can do it using a mix of JDK and Joda time: import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.joda

JAVA Date Conversion

≯℡__Kan透↙ 提交于 2019-12-06 14:45:55
How can I convert Wed Apr 27 17:53:48 PKT 2011 to Apr 27, 2011 5:53:48 PM. new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a.").format(yourDate); You can use SimpleDateFormat or JodaTime's parser. However it might be simple enough to write your own String parser as you are just rearranging fields. You can do it using a mix of JDK and Joda time : import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import org.joda.time.DateTime; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; public class