timestamp

Parse timestamp with a.m./p.m

折月煮酒 提交于 2020-01-12 14:33:29
问题 I have a file that formats time stamps like 25/03/2011 9:15:00 p.m. How can I parse this text to a Date-Time class with either strptime or as.POSIXct? Here is what almost works: > as.POSIXct("25/03/2011 9:15:00", format="%d/%m/%Y %I:%M:%S", tz="UTC") [1] "2011-03-25 09:15:00 UTC" Here is what is not working, but I'd like to have working: > as.POSIXct("25/03/2011 9:15:00 p.m.", format="%d/%m/%Y %I:%M:%S %p", tz="UTC") [1] NA I'm using R version 2.13.2 (2011-09-30) on MS Windows. My working

Parse timestamp with a.m./p.m

与世无争的帅哥 提交于 2020-01-12 14:31:55
问题 I have a file that formats time stamps like 25/03/2011 9:15:00 p.m. How can I parse this text to a Date-Time class with either strptime or as.POSIXct? Here is what almost works: > as.POSIXct("25/03/2011 9:15:00", format="%d/%m/%Y %I:%M:%S", tz="UTC") [1] "2011-03-25 09:15:00 UTC" Here is what is not working, but I'd like to have working: > as.POSIXct("25/03/2011 9:15:00 p.m.", format="%d/%m/%Y %I:%M:%S %p", tz="UTC") [1] NA I'm using R version 2.13.2 (2011-09-30) on MS Windows. My working

Parse timestamp with a.m./p.m

妖精的绣舞 提交于 2020-01-12 14:30:29
问题 I have a file that formats time stamps like 25/03/2011 9:15:00 p.m. How can I parse this text to a Date-Time class with either strptime or as.POSIXct? Here is what almost works: > as.POSIXct("25/03/2011 9:15:00", format="%d/%m/%Y %I:%M:%S", tz="UTC") [1] "2011-03-25 09:15:00 UTC" Here is what is not working, but I'd like to have working: > as.POSIXct("25/03/2011 9:15:00 p.m.", format="%d/%m/%Y %I:%M:%S %p", tz="UTC") [1] NA I'm using R version 2.13.2 (2011-09-30) on MS Windows. My working

MySQL Timestamp Difference

橙三吉。 提交于 2020-01-12 06:39:27
问题 I have a table with column timestam which stores a timestamp with this format: "2012-12-10 21:24:30" I am looking for a SQL Query that takes the current timestamp and subtracts it with the one in the column and gives the difference in this format: "3 Hours and 2 mins Remaining" Looking for a MySQL Query that does that. 回答1: use TIMESTAMPDIFF TIMESTAMPDIFF(unit,datetime_expr1,datetime_expr2) where unit argument, which should be one of the following values: MICROSECOND (microseconds), SECOND,

Query the latest document of each type on Elasticsearch

半世苍凉 提交于 2020-01-11 03:16:27
问题 I'm trying to run what started to look like a simple query on Elasticsearch, but I just can't seem to get the result I'm looking for. Here's a brief example of what I'm trying to do: I have a database of news. Each piece of news contains a source, a headline, a timestamp and a user. I want the get the last (timestamp based) headline for each available source for a given user. #!/bin/bash export ELASTICSEARCH_ENDPOINT="http://localhost:9200" # Create indexes curl -XPUT "$ELASTICSEARCH_ENDPOINT

Unable to apply methods on timestamps using Series built-ins

只愿长相守 提交于 2020-01-10 21:31:13
问题 On the following series: 0 1411161507178 1 1411138436009 2 1411123732180 3 1411167606146 4 1411124780140 5 1411159331327 6 1411131745474 7 1411151831454 8 1411152487758 9 1411137160544 Name: my_series, dtype: int64 This command (convert to timestamp, localize and convert to EST) works: pd.to_datetime(my_series, unit='ms').apply(lambda x: x.tz_localize('UTC').tz_convert('US/Eastern')) but this one fails: pd.to_datetime(my_series, unit='ms').tz_localize('UTC').tz_convert('US/Eastern') with:

How to convert Human readable timestamp to Unix timestamp by using PowerShell?

自闭症网瘾萝莉.ら 提交于 2020-01-10 05:31:06
问题 I have a following csv file format, which contains some tool information and normal time. "Tool","TimeRaised" "Abod","27-Jun-14 8:32:45 AM" "Test","27-Jun-14 8:30:42 AM" "Groupd","27-Jun-14 8:22:01 AM" "Tize","27-Jun-14 8:15:50 AM" "COrd","27-Jun-14 8:00:52 AM" I want to convert that normal time to Unix timestamp format by using PowerShell cmdlet. But I dont know which powershell cmdlet to use. 回答1: PS > Get-Date -date "27-Jun-14 8:00:52 AM" -UFormat %s 1403856052 来源: https://stackoverflow

Pandas Convert Timestamp Column to Datetime

余生长醉 提交于 2020-01-10 05:30:08
问题 Given the following data frame and necessary wrangling: import pandas as pd df=pd.DataFrame({'A':['a','b','c'], 'dates':['2015-08-31 00:00:00','2015-08-24 00:00:00','2015-08-25 00:00:00']}) df.dates=df.dates.astype(str) df['dates'] = pd.to_datetime(df.dates.str.split(',\s*').str[0]) set(df['dates']) I end up with: {Timestamp('2015-08-24 00:00:00'), Timestamp('2015-08-25 00:00:00'), Timestamp('2015-08-31 00:00:00')} I need to convert the time stamps back to datetime (really, just date) format.

Get last modified time of file in linux

China☆狼群 提交于 2020-01-09 10:02:08
问题 I am working on a C program where I need to get the last modified time of the file. What the program does is a function loops through each file within a directory and when a particular file(s) is found it calls another function to check that the last modified times of the file. Within the directory there is a mylog.txt.1 , mylog.txt.2 and mylog.txt.3 etc. When I list the directory in linux using the ll command I can see that mylog.txt.1 and mylog.txt.2 were modified on the 4th May and mylog

How to filter logs easily with awk?

痴心易碎 提交于 2020-01-09 08:04:46
问题 Suppose I have a log file mylog like this: [01/Oct/2015:16:12:56 +0200] error number 1 [01/Oct/2015:17:12:56 +0200] error number 2 [01/Oct/2015:18:07:56 +0200] error number 3 [01/Oct/2015:18:12:56 +0200] error number 4 [02/Oct/2015:16:12:56 +0200] error number 5 [10/Oct/2015:16:12:58 +0200] error number 6 [10/Oct/2015:16:13:00 +0200] error number 7 [01/Nov/2015:00:10:00 +0200] error number 8 [01/Nov/2015:01:02:00 +0200] error number 9 [01/Jan/2016:01:02:00 +0200] error number 10 And I want to