datetime-format

converting a string to np.array with datetime64, NOT using Pandas

老子叫甜甜 提交于 2019-12-06 06:03:30
I'm looking for a way to convert dates given in the format YYYYmmdd to an np.array with dtype='datetime64'. The dates are stored in another np.array but with dtype='float64'. I am looking for a way to achieve this by avoiding Pandas! I already tried something similar as suggested in this answer but the author states that "[...] if (the date format) was in ISO 8601 you could parse it directly using numpy, [...]". As the date format in my case is YYYYmmdd which IS(?) ISO 8601 it should be somehow possible to parse it directly using numpy. But I don't know how as I am a total beginner in python

SQL - Convert Datetime format

拥有回忆 提交于 2019-12-06 05:15:06
问题 I try to change my format Datetime on MySQL T got a table historic with some columns and some all them have this format DATETIME : JJ/MM/AAAA HH:MM I need to change to : AAAA-MM-JJ HH:MM:SS I don't have the variable for SS I would like to take 00. Example 01/12/2012 12:23 > 2012-12-01 12:23:00 Thanks 回答1: You need to use Format Function for that For above you can use SELECT DATE_FORMAT([YOURCOLUMNNAME],'%Y-%m-%d %h:%i:%s') from [YOURTABLENAME]; For all the conversion you can refer to. http:/

Using a datetime as filename and parse the filename afterwards?

别等时光非礼了梦想. 提交于 2019-12-06 05:09:16
I am writing files to my harddrive,The filename is build like this: String.Format("{0:yyyy-MM-dd_hh-mm-ss}.txt", DateTime.Now) So the filename is "2010-09-20_09-47-04.txt" for example. Now I want to show those filenames in a dropdown, but with another format. The format should be dd.MM.yyyy HH:mm:ss. How can I do that, or is there a better approach? Thanks :) Besnik I tried this on console and it did the job. Imports System.Globalization Module Module1 Sub Main() Dim enUS As New CultureInfo("en-US") Dim d As String = Format(DateTime.Now, "yyyy-MM-dd_hh-mm-ss") Dim da As Date = DateTime

How to format a date as localized Short MonthDay string

拥有回忆 提交于 2019-12-06 04:54:33
问题 I would like to format a DateTime to a string containing the month name abbreviated and the date for use in axis labels in a graph. The default DateTime format strings do not contain abbreviated month. I guess there is no standard but I could take a substring of the first 3 characters of the month name and replace this into the MonthDay format. The reason I would use MonthDay is that the ordering of month and date is locale dependent. Does anyone have a better idea? http://msdn.microsoft.com

how do i use timezone in Twig date filter?

跟風遠走 提交于 2019-12-06 04:20:41
问题 I am using Twig and this date filter http://www.twig-project.org/doc/templates.html#date Apparently they are looking out for DateTime instances in the parameter. looking at this http://www.php.net/manual/en/datetime.construct.php I have trouble understanding the php datetime object and how to use the timezone. Given that i know basic PHP and is familiar with simple web programming, how do I use it to display a date and time using the Twig date filter while catering for timezone? If there is a

Get 30 days back date along with time

喜你入骨 提交于 2019-12-06 03:49:35
问题 I want to calculate EXACT past 30 days time period in php from now (for example 30 aug 14 23:06) to 30 days back (for example 1 aug 14 23:06). I wrote this where current datetime goes in $d1 and past 30 days datetime goes in $d2 but somehow i am not getting correct results. Any idea? $url=$row["url"]; $pageid=getPageID($url); $date=date('y-m-d g:i'); $d1=strtotime($date); $d2=date(strtotime('today - 30 days')); Thanks 回答1: The problem is likely caused by the malformed date() call. The first

What is the culture neutral dateformat for SQL Server

前提是你 提交于 2019-12-06 02:16:54
问题 I have this question since the dawn of my programming career. Is there really a culture neutral format for datetime in sql server so that when ever I'm sending query string from a client side to the database server running sql server 2008 side having different system datetime format, and if the query contains a date converted to a string, what format would not give me an error. 回答1: I recommend reading Tibor Karaszi's The ultimate guide to the datetime datatypes. If you input your date/time

How to convert UTC to EST with Python and take care of daylight saving automatically?

时间秒杀一切 提交于 2019-12-05 21:30:42
If I have a bunch of data with date & time in UTC format , how can I convert them to EST . It can determine when they will be -4(in summer) and - 5(in winter) automatically every year? Thanks You'll need to use the pytz module (available from PyPI): import pytz from datetime import datetime est = pytz.timezone('US/Eastern') utc = pytz.utc fmt = '%Y-%m-%d %H:%M:%S %Z%z' winter = datetime(2016, 1, 24, 18, 0, 0, tzinfo=utc) summer = datetime(2016, 7, 24, 18, 0, 0, tzinfo=utc) print winter.strftime(fmt) print summer.strftime(fmt) print winter.astimezone(est).strftime(fmt) print summer.astimezone

DateTime::format and strftime

倾然丶 夕夏残阳落幕 提交于 2019-12-05 21:11:29
I have $date = $run['at']; which gives me 2013-06-03T16:52:24Z (from a JSON input). To transform it to get for example " d M Y, H:i " I use $date = new DateTime($run['at']); echo $date->format('d M Y, H:i'); Problem is I need the date in italian. And the only function that supports set_locale is strftime . How can I "wrap" DateTime::format with strftime (or replace, dunno)? setlocale(LC_TIME, 'it_IT.UTF-8'); $date = new DateTime($run['at']); strftime("%d %B", $date->getTimestamp()) ... worked. :) I believe the "proper" way should be using DateTimeZone 来源: https://stackoverflow.com/questions

Convert UTC Date to datetime string Titanium

六眼飞鱼酱① 提交于 2019-12-05 20:33:59
I have a date string "2012-11-14T06:57:36+0000" that I want to convert to the following format "Nov 14 2012 12:27" . I have tried a lot of solutions including Convert UTC Date to datetime string Javascript . But nothing could help me. The following code worked for me in android. But for ios it displays as invalid date var date = "2012-11-14T06:57:36+0000"; //Calling the function date = FormatDate(date); //Function to format the date function FormatDate(date) { var newDate = new Date(date); newDate = newDate.toString("MMMM"); return (newDate.substring(4,21)); } Can anyone help me? Thanks in