Python 3: timestamp to datetime: where does this additional hour come from?

I'm using the following functions: # The epoch used in the datetime API. EPOCH = datetime.datetime.fromtimestamp(0) def timedelta_to_seconds(delta): seconds = (delta.microseconds * 1e6) + delta.seconds + (delta.days * 86400) seconds = abs(seconds) return seconds def datetime_to_timestamp(date, epoch=EPOCH): # Ensure we deal with `datetime`s. date = datetime.datetime.fromordinal(date.toordinal()) epoch = datetime.datetime.fromordinal(epoch.toordinal()) timedelta =

Datetime Finding Days Since Date in R from csv file

I'm working with a factor of dates (dateframe$LastDate) brought in from the csv file and would like to calculate the days from today. Missing values are the norm with dates populating about 20% of 1000 rows. Here's what I have so far which is returning me the factor of days since 1970. It just feels like a lot of work to do a simple thing so I'm sure I'm off somewhere. NumberOfDays <- ifelse(!, Sys.Date()-LastDate, as.numeric(""))

Datetime Bi-weekly date 2011 VB6

I am trying to loop to get all 2011 bi-weekly dates using this code in VB6: Dim HardDate As Date Dim NumberOfDaysSince As Integer Dim modulus As Integer Dim DaysToNext As Integer Dim nextpayday As Date Dim x As Integer x = 1 DateToday = Date HardDate = Format(Now, "m/dd/yyyy") Do While x <> 20 NumberOfDaysSince = DateDiff("d", HardDate, DateToday) modulus = NumberOfDaysSince Mod 14 DaysToNext = 15 - modulus nextpayday = Date + DaysToNext Debug.Print nextpayday H

Datetime how to config time range for d3.js

I've tried setting config time range .ticks(d3.time.days, 2) for xAxis in this. var data = [{"date":"2012-03-20","total":3},{"date":"2012-03-21","total":8},{"date":"2012-03-22","total":2},{"date":"2012-03-23","total":10},{"date":"2012-03-24","total":3},{"date":"2012-03-25","total":20},{"date":"2012-03-26","total":12}, {"date":"2012-03-27","total":22}, {"date":"2012-03-28","total":21}, {"date":"2012-03-29","total":12}, {"date":"2012-03-30","total":12}, {"date":"2012-03-31","total":12}, {"date":"

Datetime How can i use the variable %TIME:~0,2% in a batch file so that times with a leading space do not cause errors?

I am trying to run a batch file, which runs an XSLT transformation against an XML file and writes out a second XML file. This XML filename is determined by the following line in the batch file: ICS_%DATE:~-4%_%DATE:~4,2%_%DATE:~7,2%_%TIME:~0,2%_%TIME:~3,2%_DATA.xml When the time has a leading space (that is, any time before 10:00 am), the variable %TIME:~3,2% returns a result with a leading space, which causes the filename to be truncated. The result file is empty. If I run the batch after

Datetime What's the issue with this ParseExact code in PowerShell

I am using the following script... $x = (Get-Date).ToString() $x #Yields 7/30/2013 12:00:10 PM $formats = "M/dd/yyyy h:m:s tt" $y = [datetime]::ParseExact($x, $formats, [System.Globalization.CultureInfo]::InvariantCulture, [System.Globalization.DateTimeStyles]::None) $y.ToString() #Yields 7/30/2013 12:00:10 PM This works as Expected. However, I need to use multiple format string in $formats. The moment I change this $formats to... $formats = "M/dd/yyyy h:m:s tt", "MM/dd/yyyy h:m:s tt" ..

Datetime alternative to piping large stream of data to xargs

I am trying to pipe a stream of string date values (YY-MM-DD HH:MM:SS) and return their epoch values and then find the largest and smallest value. For a small file, this works fine. However upon using it on a larger file, the limitations of xargs causes it to break down. is there any quick, good alternative? The line looks as follows: awk function on a file ... | xargs -i date -d "{}" +%s | another awk function ... Tried (and failed) originally to pipe into a perl script and may return to

Convert a collection of datetime to yyyy-mm-dd

I have a collection of Dates in a text file. Ex. file.txt 2011-01-01 2011-02-14 2011-02-21 2011-03-17 2011-09-11 2011-11-11 I have a function called Important-Dates which holds a collection of [datetime] dates Ex. Function holds these type of dates November-11-15 12:00:00 AM November-11-14 12:00:00 AM November-11-13 12:00:00 AM February-14-15 12:00:00 AM I want to convert the function dates into the format yyyy-mm-dd and append to the file.txt file So far, I have this: $Dates =

Datetime Solr4 max() function seems to lose precision on TrieDateField values

I have documents that have two date fields, "published_date" and "updated_date". The updated_date field is empty until an update occurs. After there has been an update, I would like to use updated_date as the field to sort by. This is not the exact situation but close enough, and index a single correct field is the least desirable solution. So I'm trying to do "sort=max(published_date, updated_date) desc" To validate the results I have "fl=max_date:max(published_date, updated_date), published_

Pandas MulitIndex forces objects to Timestamp objects

I recently updated Pandas and found this strange behaviour which broke some of my existing code. I was using a column of objects as a the second level in a two-level MulitIndex. However, when setting the index with the latest version, the objects are converted to Timestamp objects with 00:00:00 as the time component: >>> pd.__version__ '0.15.1' >>> df 0 ID date 0 0.486567 10 2014-11-12 1 0.214374 20 2014-11-13 >>>

Breeze optimistic concurrency exception saving datetime

Here a tricky issue I have with breeze, entity framework and a datetime field. I get an optimistic concurrency exception when saving the entity due to the date field having the current microseconds added to it on entering and on leaving the breeze system. Hence entity framework thinks something else has edited the db since its original value is no longer equal to what is in the db (as the microseconds value is made up on the spot). SQL like the following is produced: exec sp_executesql N'U

Datetime Date-time axis working as string, not as proper continuous date/time axis in Zing Chart

I am plotting date-time vs integer in ZingChart. Even if there is difference of one second or the difference of 1 hour, the width is same between the two points. If the starting time is same as the previous one, like in my attached image at 23:24:40, there should not a white gap in between if it is proper date and time axis. Is there any solution to this problem? You can also view it on

Datetime Docker Timezone in Ubuntu 16.04 Image

I have created a Docker container using the Ubuntu 16.04 image. docker run -it -d --name containername -v /var/www/public --privileged ubuntu after creating the container, I checked the date inside the container: $ date Tue Oct 25 08:10:34 UTC 2016 But, I need it to use the Asia/Kolkata timezone. So I tried changing the /etc/timezone file, then docker stop and docker start the container, but it doesn't work. It still shows the same time. How can I change the time zone in the Docker cont

Datetime storing client datimetime with zone in postgresql table

I want to store visitor last visit to my flask web page. for which I created db class TempTable(db.Model): __tablename__ = "tempTable" timeStamp = db.Column(types.Integer(), primary_key=True, autoincrement=True) moment = db.Column(types.Time(timezone=True)) def __init__(self, tsz, moment): self.timeStamp = tsz self.moment = moment but since I want visitor datetime with zone to be stored in the moment column in above table, in my flask app I am creating date

Datetime Cannot iterate through days past the end of year in Golang's Time package

I'm trying to iterate through days between 2 dates. One date is time.Parse("2006-01-02", "2017-08-24") another is time.Now() but my loop seems to be stopping at the turn of the year and I can't figure out why. func IsToday(date time.Time) bool { today := time.Now() return date.Year() == today.Year() && date.Month() == today.Month() && date.Day() == date.Day() } t1, _ := time.Parse("2006-01-02", "2017-08-24") for curr := t1; !IsToday(curr); curr =

Datetime How to get local system timezone in ActionScript?

I want to find the local system timezone using ActionScript 3, I have tried many ways but unable to get any solution which will give me the actual result like if I will select (UTC -8:00)Pacific Time then the result will come UTC -8:00 or (UTC -8:00)Pacific Time (Results in UTC time zone). So if anyone know how to achieve this please help me to resolve this issue. Thanks in advance.

Datetime What am I doing wrong converting these times from UTC to Local?

Using the GitHub API, timestamps are returned in UTC. I'm using the following to convert these into a Delphi TDateTime... with TXSDateTime.Create do try XSToNative('2019-07-27T19:33:02Z'); Result:= AsDateTime; finally Free; end; I don't recall where I found that function. The value 2019-07-27T19:33:02Z comes directly from the GitHub API on a particular repository's "pushed_at" field (last pushed). After converting it using the function above, I get (formatted

cakephp 3.8.8 Cannot convert value of type `string` to integer when saving field deadline as datetime

Cakephp not saving the selected value of date field I have form with field like: <? echo $this->Form->control('deadline', ['class' => 'form-control text-form-control', 'type' => 'datetime']); ?> I can edit and change date with existing task in database, but when I adding new task I have an error with massage: Cannot convert value of type `string` to integer InvalidArgumentException In table model I have: <?php public function beforeMarshal(Event $event, ArrayObject

Datetime Index mapping having date format, using curl throws parsing exception

Trying to specify format (in index mapping) for the date field in ES 7.6. Any of these are not accepted: "createdAt" : { "type" : "date", "format": "yyyy-MM-dd'''T'''HH:mm:ss.SSSZZ" }, "createdAt" : { "type" : "date", "format": "yyyy-MM-dd'T'HH:mm:ss.SSSZZ" }, Error is always the same: "type" : "illegal_argument_exception", "reason" : "Invalid format: [yyyy-MM-ddTHH:mm:ss.SSSZZ]: Unknown pattern letter: T",

Datetime Convert time to am/pm flutter

How to convert the time to am/pm ? I have this output I/flutter (17720): 9:00:00 I/flutter (17720): 11:00:00 I/flutter (17720): 12:00:00 This is what I have tried final item =[index]; print("Time " + item['time'].toString()); DateTime dateTime = DateTime.parse(item['time'].toString()); print(DateUtil().formattedTime(dateTime)); DateUtil String formattedTime(DateTime dateTime) { return DateFormat().add_jm().format(dateTime); } Error I/flutter (17720): Time

Datetime Flutter - How to find difference between two dates in years, months and days?

I'm looking for a way to use DateTime to parse two dates, to show the difference. I want to have it on the format: "X years, Y months, Z days". For JS, we have momentjs library and following code:: var a = moment([2015, 11, 29]); var b = moment([2007, 06, 27]); var years = a.diff(b, 'year'); b.add(years, 'years'); var months = a.diff(b, 'months'); b.add(months, 'months'); var days = a.diff(b, 'days'); console.log(years + ' years ' + months + ' months ' + days + ' days'); // 8 years 5 month

Datetime summarize uptime % per day based on ON/OFF events table

I am really stuck with a customer request (in two places), so am enlisting the wisdom of the crowd... My input is a table with timestamps and on/off events, for certain equipment. Here is some sample data: 2020/02/12 21:05:34 TYPE A ON 2020/02/12 21:10:34 TYPE B ON 2020/02/12 22:05:34 TYPE A OFF 2020/02/12 22:15:35 TYPE B OFF 2020/02/13 01:00:35 TYPE A ON 2020/02/13 02:05:34 TYPE A OFF 2020/02/13 15:05:35 TYPE B ON 2020/02/13 15:30:34 TYPE A ON 202

Dart sort / compare nullable datetime

I'm trying to compare list of music with releaseDate. But I can retrieve music without releaseDate and when I want to sort them, I got an error. How can I sort / compare nullable datetime and put null releaseDate to the end? _followedMusic.sort((a, b) { if (a.releaseDate != null && b.releaseDate != null) return a.releaseDate.compareTo(b.releaseDate); else // return ?? }); Thank you

Datetime Time diff calculations where date and time are in seperate columns

I've got a query where I'm trying to get the hours in duration (eg 6.5 hours) between two different times. In my database, time and date are held in different fields so I can efficiently query on just a startDate, or endDate as I never query specifically on time. My query looks like this SELECT COUNT(*), IFNULL(SUM(TIMEDIFF(endTime,startTime)),0) FROM events WHERE user=18 Sometimes an event will go overnight, so the difference between times needs to take into account the differences betwe

Datetime R time series object with two time dimensions

When you study time series forecast you most often have to deal with two times: the time you issue your forecast and the time you make your forecast for. These two times are not regularly sampled in general. What R object do you suggest to deal with these two times ? please indicate advantages and drawback. If no object exist, how should I use existing S4 object to create what I need? Thanks in advance for sharing your experience in R with this type of data

Datetime Filtering between two same date but different time - jasper

I'm creating a jasper report which has the parameters of datetrfrom and datetrto. The filtering goes well except when the the two parameters carry the same data such as datetrfrom>= '15-12-2012' datetrto<= '15-12-2012' The data which are processed on the 15-12-2012 will not come out. I tried this in my JSP : function ShowReport(){ var param=''; var timestart = ' 00:00:00' var timeend = ' 23:59:59' var datetrFrom = document.forms['report']['datetransfrom'].value; datet

User can't delete DateTime in old Infragistics UltraGrid

I'm working on an older application now which uses Infragistics UltraGrid v3.1. In the UltraGrid the user can enter a date (with mask ____/____/_____). If there is already a date in the cell and the user wants to clear it, he'll get an error when he leaves the cell ("Unable to update the data value: Value in the editor is not valid") . When there is a DBNull value in the database the UltraGrid just shows an empty cell. If I click on an empty date cell the mask appears, when I leave this cell th

Datetime Can i compose a posix_time::ptime object my self?

I have a object which have a boost::posix_time::ptime object in it. And I will get the time from other library which doesnt provide standard time struct, they have their own customized time struct My problem is that, can I compose a ptime object by simply setting those hour/min/sec/millisec variables. Cuz I have tried to do that, It seems that I cant access to them to set value. Thanks

Unable to store datetime.datetime.max using SQLAlchemy==0.8.1 with the mysql-python==1.2.4 driver

I've noticed a change in behavior for storing datetime.datetime.max via SQLAlchemy==SQLAlchemy==0.8.1 and going from mysql-python==1.2.3 to mysql-python==1.2.4. By only changing the driver from 1.2.3 to 1.2.4 I go from being able to store to being unable to store it. Where do I turn to for help in this matter? SQLAlchemy or mysql-python? Is this expected behaviour or a bug or do I have a bad setup? I fear that a change like this will break a lot of systems out there. This is my SQLAlchemy setu

Datetime Reading custom date time formats with SAS

I have a comma delimited data set whose first 2 rows is like this: 1/13/2010 21:09,3.3 11/30/2010 7:33,7.2 .... In trying to read the data in SAS, I have done this data step below: data myDataSet; infile 'sampleData.csv' dlm=','; input timestamp :mmddyy16. value; run; Now that the data is now a SAS data set, I try to view it by doing: data viewData; set myDataSet; format timestamp date9.; run; proc print data=viewData; run; I o

Datetime How to change the project default Time format in Rails

Before I updated Rails, the default Time format the API was returning was yyyy-MM-dd'T'HH:mm:ss'Z'. Now it returns yyyy-MM-dd'T'HH:mm:ss:sss'Z'. I want to change it back due to apps that rely on the old time format. How can I change this PROJECT default format that Time::DateTime's to_s method returns? Edit: I should probably mention I started using the active_model_serializer gem. Not sure if that makes a difference. My guess is this change happened after the update from Rails 4.0.x to 4.1.x.

Datetime DateFormat default mask

In either CF 10 or CF 11 is there a way to change the default mask used by the DateFormat() function? The Adobe docs indicate the default is "dd-mmm-yyyy" but I haven't seen anything about whether that default can be changed or not. I'm hoping there is an Application setting somewhere to change it.

How to handle Edm:DateTime form OData interface in SAPUI5 correct?

Is there a definition what values should be send in OData Edm:DateTime of a SAP Netweaver Gateway service? Especially should it always be interpreted as UTC? I assume the SAPUI5 library is smart enough to handle all this time zone problems automatically if the interface is correct defined -- question is, what is correct? I would prefer to use some code like this, at client side: new sap.m.DatePicker({ value : { path : "BirthDate", type : new sap.ui.model.type.Date

TFS Power Tool (tfpt) update datetime field syntax

I'm attempting to use Team Foundation Power Tools to update a custom datetime field and cannot seem to find the correct syntax. Context VS2013 with TFPT installed TFS 2013 Update 4 I'm trying to do this through powershell I've created a custom datetime field which I would like to set to a specific datetime. I can set other fields without issue, and the field is a datetime type. I have tried the commands using Xml datetime format, and my current locale (English US) and neither seem to be a

Datetime How to display monthly data in Highcharts graph?

Looks like a dumb question. And probably is. But I don't really get it. I have monthly data over a ~30-year-period. I am neither sure how to format the data, nor am I sure how to format the Highcharts graph. What is the correct way of data formatting? Like a "running month", from 1 to 433 (and more): Date,Value 1,338.45 2,339.15 3,339.47 or in Date.UTC format: Date,Value Date.UTC(1980,1,1),338.45 Date.UTC(1980,2,1),339.15 Date.UTC(1980,3,1),339.47 I've done something similar like this,

Datetime batch file Subtracting hour current time on Windows

I need to subtract, for example, 1 hour from current time in a .bat file on Windows 7. I do it like this. set day=%date:~0,2% set month=%date:~-7,2% set year=%date:~-4,4% :: ———————————————————————– set hour=%time:~0,2% set /A hour= hour - 1 if %hour% lss 0 set hour=23 if %hour% lss 10 set hour=0%hour% echo %year%-%month%-%day% %hour%:00 But the problem, it is get consistence when the subtracting results a day before on a month before. For example, this date, 2016-03-01 00:05 I get 2016-0

when plotting a graph using bokeh, how to remove missing date while x_axis type is datetime ,

I'm recently trying to plot stock data using bokeh, the data to plot is dataframe of pandas, like date value 0 2017-01-01 10 1 2017-01-02 20 2 2017-01-03 15 3 2017-01-06 30 4 2017-01-07 25 Since there are not trades on Saturday and Sunday, there are not records in this dataframe. So this is the image I drawed Is there any way to remove the two space bar? My codes here: import pandas as pd from bokeh.plotting import figure from import sh

Timex.to_naive_datetime subtracts an hour

Calling Timex.to_naive_datetime to convert to a naive datetime without the timezone subtracts an hour from the input datetime I have tried other timezones and ruled out the possibility of daylight saving time conversion. d = %DateTime{ year: 2000, month: 2, day: 29, zone_abbr: "CET", hour: 23, minute: 0, second: 7, microsecond: {0, 0}, utc_offset: 3600, std_offset: 0, time_zone: "Europe/Warsaw" } #=> # DateTime<2000-02-29 23:00:07+01:00 CET Europe/Warsaw> Timex.

Datetime Current Year Sales and Previous Year Sales in the same table?

Good Morning, I am looking to add 'Previous Year Sales' to the same week into a Teradata pull, but I am failing on the coding. The Baseline I would code to get the sales of that week/year would be: SELECT a."WEEK_NBR" AS "YearWeek" , SUM(a."Sales") AS "CurrentYearSales" FROM "SALESTABLE" AS a Which would result in: YearWeek CurrentYearSales 201901 $7,499 201902 $2,300 201903 $6,360 ... 202001 $4,500 202002 $9,000 202003 $8,500 I want to be able to have the Prio

Datetime Get Azure AD audit logs using Reporting API

I want to specify the time when acquiring the Azure AD audit log. What kind of method should be used for Japanese tenants? Currently, the time is specified by the following method. When specifying "dateTime" in the filter, is it specified in UTC? Or is it OK to specify in (UTC +9: 00) because it is a Japanese tenant? Sorry for your inconvenience, but thank you. $FilterDate = Get-Date (Get-Date) . AddDays (-1) -Format "yyyy-MM-dd" $url = "$resource/beta/auditLogs/directoryAudits?$filter=st

UWP DataGrid Datetime binding issue

I have a sample project with an DataGrid that have a DataGridTemplateColumn that have as DataTemplate a CalendarDatePicker, If I try to add a row to the binded ItemSource, the date is always 01/01/1920. I have check inside the ItemSource, and the value is correct (es. DateTime.Now). I have attached the project. How can I solve this issue? Project

Datetime Convert publishedAt (API TIME) into normal time

1.Do I have to have two views in xml layout, one for time and one for date? but in the URL (when I read the information in JSON formatter publishedAt (has time and date) So how do I convert the time stamp of JSON into normal time. The time or date you can say is in this format 2020-01-09T14:50:58.000Z Should I convert it when I am in my Adapter file or should I do it in the QueryUtils where I am creating and extracting things from JSON. **My** try { JSO

How to Convert Filetime to Datetime in C++ (MFC/Win32)

I am trying to get Windows boot up time using WMI query and got it as CIM_DATETIME format. I converted it into File time .The value I get form it is 132372033265000000. I need to convert it in to Date time(Sunday, June 21, 2020 8:55:27am). I found many solutions in C# but couldn't able to find one in C++.

Datetime Unable to parse yyyyMMdd with DateFormat of intl in dart

I have a date string like '20200814' that means day 14 of month 08 of year 2020. In the docs of intl it said this: 'yyyy.MM.dd G 'at' HH:mm:ss vvvv' 1996.07.10 AD at 15:08:56 Pacific Time So if I use this: DateFormat('yyyyMMdd').parse('20200814') It must works, but throw this error: ════════ Exception caught by animation library ═════════════════════════════════ The following FormatException was thrown while notifying status listeners for AnimationController: Trying to read MM from 20200814 at p

  1    2   3   4   5   6  ... 下一页 最后一页 共 12 页