Sunday, July 22, 2018

Marriage

Marriage according to Merriam-Webster is "the state of being united as spouses in a consensual and contractual relationship recognized by law". 

Oxford Dictionary says "The legally or formally recognized union of two people as partners in a personal relationship (historically and in some jurisdictions specifically a union between a man and a woman)".

The above definition clearly states "legal" and "law". It is therefore an institution of the state. As such, it is not unusual for same-sex marriage to be recognized legally. Quite a number of countries has already passed laws allowing such same-sex marriage or "Ceremonies of Commitment". 

Christians have traditionally take marriage as "Therefore shall a man leave his father and his mother, and shall cleave unto his wife: and they shall be one flesh" KJV Gen 2:24. Would this view clash with the States' law of same-sex marriage?

Jesus said "Therefore render to Caesar the things that are Caesar’s, and to God the things that are God’s" ESV Matt 22:21. The verse is generally treated as separation of state and religion. It does apply to the views of marriage. 

Traditionally marriage refers to the matrimony between a man and a woman. If the state wants to add same sex marriage, there is nothing to prevent the state doing so. It is after all a "legal term" - a piece of legal contract between two person and is modified to be gender neutral.

Christians also depends on such legal document to protect either party in the marriage as required by the law. 

Same sex marriage, although recognized by the law, is very different from the traditional marriage.

1. It does not define sex (although generally acknowledged). Same gender sex is an abomination in Christianity Leviticus 18:22. Leviticus 20:13.

2. Same sex marriage does not produce next generation. If it is so common then human race is destined for annihilation. In a graying world, this escalates the issue. Obviously they can choose to adopt but it will be very difficult if same sex marriage is common.

3. No such gender specific term as husband and wife since it is gender neutral rendering it as obsolete. The term Dad and Mom will also be obsolete.

The state has to recognize the there are many religion that opposes same sex marriage and has to accept "freedom of religion" beliefs. Pious religious person need to adhere to their religious teachings while acknowledge (not accept) the fact that the law allows same sex marriage. If most people in the country accepts the changing of law to allow same sex marriage, there is nothing you can do. I like to put it as "religious tolerance".



Thursday, July 12, 2018

SQLITE Datetime Query

SQLITE does not have date datatype fields. The date information is either entered as text or numbers. Querying and getting the information is a bit tricky.

If it is a text, the date is stored as YYYY-MM-DD HH:MM:SS.SSSS.

If it is a Julian date, the data is stored as REAL, a float type.

If it is a Unix timestamp, it is stored as INTEGER.

Normally we want to get the data formatted according to local date time format. Singapore format is DD/MM/YYYY.  To get the data we use SQLITE function strftime.

If it is a text or Julian Date, we use strftime('%d/%m%Y %H:%M:%S',fieldname).

If it is Unix datetime, we use strftime('%d/%m%Y %H:%M:%S',fieldname,unixepoch).

The above is both applicable in the SELECT and WHERE query. You can use datetime('now') when adding/updating to add current date time.

Often we need to find the difference between two datetime. Using the above method, the difference can be found for text and Julian date. Use strftime and %S, %M, or $H or even %d or %M to find  the difference in the respective area. For Unix timestamp, since it is already in seconds, it is simply one minus the other as they are already integer values.

Now getting an offset of a date time is also not that difficult. Use datetime(fieldname, '+' || offset || ' minutes') to add minutes (can be any part of a datetime).

Conclusion, it is a bit troublesome but manipulating datetime in SQLITE is not that difficult.