I try to convert the character "Friday, March 24, 2017 4:39:46 PM" into a date, but it does not work. dat.1 results in NA. Can anyone tell me, how to fix it.
dat <- c("Friday, March 24, 2017 4:39:46 PM")
dat.1 <- strptime(dat, format="%A, %B %d, %Y %I:%M:%S %p")
dat.1
Result
[1] NA
EDIT. K..pradeeep pointed out that the code is running on his pc. On my it does not work. I use a Macbook Air, OS X 10.12.3. Version:
platform x86_64-apple-darwin15.6.0
arch x86_64
os darwin15.6.0
system x86_64, darwin15.6.0
status
major 3
minor 4.0
year 2017
month 04
day 21
svn rev 72570
language R
version.string R version 3.4.0 (2017-04-21)
nickname You Stupid Darkness
Related
I type M-x org-agenda in org-mode, the list of commands shows, I press a, the agenda buffer opens but only shows the dates, and pressing L won't expand:-
Week-agenda (W27):
Monday 1 July 2019 W27
Tuesday 2 July 2019
Wednesday 3 July 2019
Thursday 4 July 2019
Friday 5 July 2019
Saturday 6 July 2019
Sunday 7 July 2019
================================================================
Global list of TODO items of type: ALL
I am seeing the same problem with emacs 24, 25, 26 on Win 7. The same file shows detailed timelines fine on a debian machine.
As reported in a now deleted comment, timeline view is no more (org-mode version 9.1 onwards). See https://www.orgmode.org/Changes_old.html
I'm new to KDB and I'm looking at it from a security stand point.
Can I run a combination of a DB query and an OS command as a one liner?
Or, can I store the OS command's output to a DB object?
I've been playing around with KDB Q, but either it's not possible or
I haven't found the proper syntax.
Thank you
Yes, see below:
q)update res:system each cmd from ([] cmd:("uptime";"date";"uname -a"))
cmd res
----------------------------------------------------------------------------------------------------------------------
"uptime" " 21:01:03 up 31 days, 6:54, 8 users, load average: 0.00, 0.03, 0.00"
"date" "Fri 17 Mar 21:01:03 GMT 2017"
"uname -a" "Linux glyph01 4.4.0-62-generic #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux"
Running a system command is more or less the same as running any other function in Kdb+.
I have problem formatting and dealing with dates before the epoch 1/1/1970 in Perl, dates comes back as negative integer:
my $time=timelocal(0, 0, 0, 1, 1, 1969);
print "$time\n";
$theTime = localtime($time);
print "the time is good: $theTime\n\n";
How to deal with dates before the epoch in Perl, both on unix and windows have the same problem Perl 5.8.8. PHP shows the date normal without problems.
have you tried using DateTime?
If perl print a negative integer, this is the good behaviour since 01/01/1970 is the zero day of this date format. Search the word negative on https://en.wikipedia.org/wiki/Unix_epoch
An example in shell :
$ date -d "1957-10-04T00:00:00Z" +%s
-386380800
This is correct.
I need is to pass this negative number to localtime or some other function to return formated date time array.
Ok, what's stopping you?
# ActivePerl on Windows
>perl -E"say ''.localtime(-386380800)"
Thu Oct 3 20:00:00 1957
# Linux
$ perl -E'say "".localtime(-386380800)'
Thu Oct 3 16:00:00 1957
# Cygwin
$ perl -E'say "".localtime(-386380800)'
Thu Oct 3 16:00:00 1957
in Perl
how do I get current London time? GMT has offset with BST
is it possible to get the TZ offset or the time itself for a different timezone
from a NY Red Hat Linux machine?
-Thanks much
use DateTime;
say "UTC:\t\t" . DateTime->now->iso8601;
say "London time:\t" . DateTime->now->set_time_zone("Europe/London")->iso8601;
UTC: 2011-04-24T17:45:16
London time: 2011-04-24T18:45:16
Use the DateTime modules. They have all sorts of date and time calculation tools, including timezone support.
The Time Zones FAQ will get you started on common timezone issues.
In standard Perl:
% env TZ=Europe/London date
Sun Apr 24 19:51:24 BST 2011
% env TZ=Europe/London perl -le 'print scalar localtime'
Sun Apr 24 19:51:37 2011
% env TZ=Europe/London perl -MPOSIX=strftime -le 'print strftime "%x %X %Z (%z)", localtime'
04/24/11 19:51:52 BST (+0100)
I recently stumbled upon a cool feature in CVS where you can name revisions by date, e.g.:
# List changes made between the latest revision 24 hours ago and now
cvs diff -D "1 day ago"
Do any other repository systems (e.g. Git, SVN, Bazaar, Mercurial, etc.) have an option like this?
Subversion has a similar feature. For example:
svn diff -r {2010-07-31}
The syntax is explained in http://svnbook.red-bean.com/en/1.5/svn.tour.revs.specifiers.html#svn.tour.revs.dates
Mercurial has a wide range of date formats: http://www.selenic.com/mercurial/hg.1.html#date-formats, though maybe not "1 day ago".
This subversion bug report indicates that Subversion can't do it natively, but does offer a tip on using date to do it:
(2) Whilst Subversion doesn't understand -r "{3 days ago}", date can
help out there too: -r "{date -Is -d '3 days ago'}".
(answering my own question)
git log supports dates for filtering before or after given times. Example:
git log --after='july 17 2010' --before='july 31 2010'
Here's a shell script that makes it a little easier to list ranges of commits, but it also uses a terser format than git log's default:
#!/bin/sh
# git-changes
FORMAT='%cd%x09%h%n%x09%s%n'
CMD="git log --format=format:$FORMAT"
case $# in
0 )
$CMD ;;
1 )
$CMD "--after=`date -d "$1"`" ;;
2 )
$CMD "--after=`date -d "$1"`" --before="`date -d "$2"`";;
esac
Note: I wrapped the date arguments with the date command, since git treats 'July 17' as a few hours off from 'July 17 2010' for some reason.
Usage:
git-changes # Same as git log, but more terse
git-changes 'yesterday' # List all commits from 24 hours ago to now
git-changes 'jul 17' 'aug 1' # List all commits after July 17 at midnight
# and before August 1 at midnight.
Sample output of git-changes 'jul 17' 'aug 1':
Sat Jul 31 23:43:47 2010 -0400 86a6727
* Moved libcurl into project directory as static lib.
Sat Jul 31 20:04:24 2010 -0400 3a4eb10
* Added configuration file support.
Sat Jul 31 17:44:53 2010 -0400 aa2046b
* Fixed truncation bug in bit parser.
Sat Jul 17 00:10:57 2010 -0400 99e8124
* Added support for more bits.
Now, to see all changes introduced by commit 99e8124, type git show 99e8124. To see all changes since revision 99e8124 (not including that commit itself), type git diff 99e8124.