recentpopularlog in

kme : dateandtime   34

macos - Add a locale in Mac OSX - Stack Overflow
Looking into this found that, as of Mac OS X 10.10.3, collation is still broken for Spanish and most European languages. Collation definitions for these locales are linked to an ASCII definition. This ends up breaking things such as ORDER BY clauses on PostgreSQL.

Also, WTF is does 'la_LN' mean anyway?
macos  elcapitan  annoyance  sorting  brokenness  collation  lc_all  dateandtime  unix  maybesolution 
july 2019 by kme
Manual:Timezone - MediaWiki |
<code class="language-php">#Set Default Timezone
$wgLocaltimezone = "Asia/Jakarta";
date_default_timezone_set( $wgLocaltimezone );</code>
mediawiki  configsetting  dateandtime  localtime  timezone  solution 
june 2018 by kme
How do you set a default value for a MySQL Datetime column? - Stack Overflow

In version 5.6.5, it is possible to set a default value on a datetime column, and even make a column that will update when the row is updated. The type definition:

<code class="language-sql">CREATE TABLE foo (
mysql  dba  timestamps  dateandtime  mysql56  sortof  solution 
march 2018 by kme
command line - How do I convert an epoch timestamp to a human readable format on the cli? - Unix & Linux Stack Exchange |
The "@<epoch_seconds>" isn't documented in the 'date' man page, but see 'info coreutils "Date input formats"' for the down-low.
On *BSD:

date -r 1234567890

On Linux (specifically, with GNU coreutils ≥5.3):

date -d @1234567890

With older versions of GNU date, you can calculate the relative difference to the UTC epoch:

date -d '1970-01-01 UTC + 1234567890 seconds'

If you need portability, you're out of luck. The only time you can format with a POSIX shell command (without doing the calculation yourself) line is the current time. In practice, Perl is often available:

perl -le 'print scalar localtime $ARGV[0]' 1234567890
dateandtime  unix  linux  shellscripting  epoch  timestamp  cheatcode  solution 
october 2017 by kme
How do I translate a ISO 8601 datetime string into a Python datetime object? - Stack Overflow
I prefer using the dateutil library for timezone handling and generally solid date parsing. If you were to get an ISO 8601 string like: 2010-05-08T23:41:54.000Z you'd have a fun time parsing that with strptime, especially if you didn't know up front whether or not the timezone was included. pyiso8601 has a couple of issues (check their tracker) that I ran into during my usage and it hasn't been updated in a few years. dateutil, by contrast, has been active and worked for me:

import dateutil.parser
yourdate = dateutil.parser.parse(datestring)
python  datetime  dateandtime  parser  parsing  iso8601  solution 
april 2017 by kme
For a Good Strftime - Easy Skeezy Ruby Date/Time Formatting
The proper ISO8601 format for Python's datetime: %Y-%m-%dT%H:%M:%S.%f (which was originally generated by

So, in summary:

timestamp =
dt = datetime.datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%S.%f')
webapp  generator  strftime  dateandtime  stringformatting  python  ruby  solution 
june 2016 by kme
PHP: America - Manual


Error message if you don't set it looks something like:
Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
php  dateandtime  timezone  reference  webdevel  essential  errormessage 
september 2014 by kme
Timestamp support for Rails and MySQL/PostgreSQL/Oracle « So far, it’s RoR
:conditions => "timestamp > #{start_time} AND timestamp < #{end_time}")
rails  dateandtime  dba  query  timestamp  reference 
july 2014 by kme
ruby - how to check string is valid date or not in rails - Stack Overflow
require 'date'
rescue ArgumentError
# handle invalid date
ruby  rails  datetime  webdevel  dateandtime  solution 
july 2014 by kme
ruby - Default TimeZone with ActiveSupport (without Rails) - Stack Overflow
I wanted to know how to include ActiveSupport:TimeWithZone in an initializer that didn't have access to the whole Rails environment yet. I think this was how:
irb -r 'rubygems'
ruby-1.8.7-p174 > require 'active_support'
ruby-1.8.7-p174 > require 'active_support/time_with_zone'
ruby-1.8.7-p174 >
ruby-1.8.7-p174 > nil
rails  activesupport  dateandtime  fuckina  solution 
july 2014 by kme
How do I set the timezone for Perl's localtime()? - Stack Overflow
Still doesn't answer the question of why $TZ isn't set on Mac OS X. Is it ever set, anywhere, unless you set it? Why?
timezone  dateandtime  perl  programming  solution 
august 2012 by kme

Copy this bookmark:

to read