How To Get a Formatted Date in Perl
1 2 3 |
use POSIX qw(strftime); my $stamp = strftime "%Y%m%d%H%M%S", localtime; my $stamp = strftime "%Y%m%d%H%M%S", gmtime; |
1 2 3 |
use POSIX qw(strftime); my $stamp = strftime "%Y%m%d%H%M%S", localtime; my $stamp = strftime "%Y%m%d%H%M%S", gmtime; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#!/bin/sh DATE=`date` ( echo "From: Your Full Name <you@yourdomain.com>" echo "To: you@yourdomain.com" echo "Subject: AWS Instances Report for All Customers as of $DATE" cat <<EOT MIME-Version: 1.0 Content-Type: text/html Content-Disposition: inline <html> <body> <pre style="font: monospace"> EOT for profile in customer1 customer2 customer3; do for region in `aws ec2 describe-regions --output text | cut -f3`; do echo -e "\nListing Instances for profile $profile in region: '$region'..." aws ec2 describe-instances \ --filters "Name=instance-state-name,Values=running" \ --query 'Reservations[*].Instances[*].[InstanceId, PublicIpAddress, LaunchTime, InstanceType, Tags[?Key==`Name`] | [0].Value]| sort_by(@, &@[0][2])' \ --region $region \ --profile $profile \ --output table done done cat <<EOT </pre> </body> </html> EOT ) | /usr/sbin/sendmail -t |
For a quick visual check to see what the human-readable date is based on a UNIX timestamp integer: php -r ‘print date(“r”,1483228799);’ php -r ‘print strtotime(“1 Jan 2015”) – 1;’
Things sure have been busy! Multiple client projects in parallel always seem to make time go faster. Now that two different websites have been launched, things should calm down a tad. The concept of having weekends off for a while is very attractive. I realized recently that the consulting business has been a crazy ride […]
1 2 3 4 5 |
date_default_timezone_set('America/New_York'); $datetime1 = new DateTime('2009-10-31'); $datetime2 = new DateTime('now'); $interval = $datetime1->diff($datetime2); print $interval->format('%a days_elapsed'); |
http://www.php.net/manual/en/datetime.diff.php
I cannot understand where this month went. Just trying to do too much in an effort to survive. Am pursuing some sales leads that look promising and have existing client projects that are coming along well. Simply MUST FINISH them! These are not easy times for this country, except for those in power who get […]
Extremely simple way to set the date and time the same as another server: (Requires SSH access to the server that has the time you want to copy; does NOT have to be root access) [code]root@host# date ssh user@timehost date "+%Y%m%d%H%M.%S"[/code]
Looked up and saw that two hours have gone by – where do they go so quickly? Had some dinner, chatted with my lovely wife who is stuck at work a bit longer. The faster I can succeed so that she does not have to slave away for corporate America, the happier I will be. […]