Re: Storing Dates and Times From Different Time Zones

2018-12-21 Thread Kirk Brooks via 4D_Tech
https://www.youtube.com/watch?v=jgF_ycCmF18
It just had to be said.

On Thu, Dec 20, 2018 at 6:04 PM Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> is this a competition?
>
-- 
Kirk Brooks
San Francisco, CA
===

*We go vote - they go home*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Storing Dates and Times From Different Time Zones

2018-12-21 Thread Arnaud de Montard via 4D_Tech

> Le 20 déc. 2018 à 18:54, Nate Rheaume via 4D_Tech <4d_tech@lists.4d.com> a 
> écrit :
> 
> We have clients that are accessing the same server database from different 
> time zones. We would like to store date/time using GMT and then display it in 
> the users local time zone.


As I understand, these timestamps are stored as strings. You may find 
interesting to use long integer fields instead, as in the examples here:

I use that since a very long time and never regretted. It's numbers, I can add 
or subtract easily. BTW date and time in a spreadsheet are of the same family: 
a number where integer portion = day and fractional portion = hour. 

-- 
Arnaud de Montard 




**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Storing Dates and Times From Different Time Zones

2018-12-20 Thread Keisuke Miyako via 4D_Tech
this works for dates...but not very practical, obviously.

C_DATE($d)
C_TIME($t)

$dbp:=Get database parameter(Dates inside objects)
SET DATABASE PARAMETER(Dates inside objects;String type with time zone)
$d:=JSON Parse("\""+$ISO+"\"";Is date)
XML DECODE($ISO;$t)
SET DATABASE PARAMETER(Dates inside objects;$dbp)





**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Storing Dates and Times From Different Time Zones

2018-12-20 Thread Keisuke Miyako via 4D_Tech
oops!

this works for the time but not the date!

2018/12/21 11:02、Keisuke Miyako via 4D_Tech 
<4d_tech@lists.4d.com>のメール:
XML DECODE($ISO;$d)



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Storing Dates and Times From Different Time Zones

2018-12-20 Thread Keisuke Miyako via 4D_Tech
is this a competition?

then here's my entry:

$ISO:=String(Current date;ISO date GMT;Current time)

C_DATE($d)
C_TIME($t)

XML DECODE($ISO;$d)
XML DECODE($ISO;$t)



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Storing Dates and Times From Different Time Zones

2018-12-20 Thread John DeSoi via 4D_Tech
I use the code below to determine the number of seconds offset from GMT for the 
current time zone. This could be added back to a GMT time stamp to get the 
local time.

John DeSoi, Ph.D.


C_LONGINT($0)

C_DATE($zDate;$gmtDate)
C_TIME($zTime;$gmtTime)
C_TEXT($str)

$zDate:=Current date

$str:=String($zDate;ISO date GMT;$zTime)  //2010-09-13T16:11:53Z
$str:=Substring($str;1;Length($str)-1)  //Remove the Z or it gives us back 
local time.
$gmtDate:=Date($str)
$gmtTime:=Time($str)

Case of 
  : ($zDate=$gmtDate)
$0:=$zTime-$gmtTime
  : ($zDate>$gmtDate)
$0:=(?24:00:00?-$gmtTime)+$zTime
  : ($gmtDate>$zDate)
$0:=0-((?24:00:00?-$zTime)+$gmtTime)
End case 


> On Dec 20, 2018, at 11:54 AM, Nate Rheaume via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> We have clients that are accessing the same server database from different 
> time zones. We would like to store date/time using GMT and then display it in 
> the users local time zone.
> 
> Using the String command it's easy to convert to GMT but I'm not sure what 
> the best way is the convert GMT back to the local time zone.
> 
> Has anyone else dealt with this issue? Any feedback is appreciated.

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Storing Dates and Times From Different Time Zones

2018-12-20 Thread Timothy Penner via 4D_Tech
Tech Tip: Convert ISO GMT date string to local time, date and ISO date string
http://kb.4d.com/assetid=77110

-Tim




-Original Message-
From: 4D_Tech <4d_tech-boun...@lists.4d.com> On Behalf Of Nate Rheaume via 
4D_Tech
Sent: Thursday, December 20, 2018 9:55 AM
To: 4d_tech@lists.4d.com
Cc: Nate Rheaume 
Subject: Storing Dates and Times From Different Time Zones

We have clients that are accessing the same server database from different time 
zones. We would like to store date/time using GMT and then display it in the 
users local time zone.

Using the String command it's easy to convert to GMT but I'm not sure what the 
best way is the convert GMT back to the local time zone.

Has anyone else dealt with this issue? Any feedback is appreciated.



Nate Rheaume
Software Developer
n...@dwdev.com
(425) 673-1974
www.freezerworks.com
Dataworks Development, Inc.
Providing secure and configurable data management solutions for research and 
clinical labs since 1987.


**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**