Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Json weird date format
Message
De
08/10/2020 13:05:54
 
 
À
02/10/2020 20:15:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Web Services
Divers
Thread ID:
01676446
Message ID:
01676513
Vues:
42
>Luis,
>
>A bit of guesswork, here: could it be an interval time since 1970-01-01 00:00:00, expressed in milliseconds, and with a UTC offset?
>
>If so, the date would be evaluated as {^1970-01-01 00:00:00} + 1579669200000 / 1000, local time, plus 5 * 60 * 60 for UTC time (or {^2020-01-22T05:00:00}).
>
>>Hi, Im developing a small interface between and VFP9 desktop application and a web service. This WS needs to send it some data en Json format, 95% of the data can be generated without problems, but some date data require a weird format. Below is an example
>>
>>/Date(1579669200000-0500)/
>>
>>I googled and couldn't find anything that can generate that weird format using VFP.
>>
>>Any suggestions.
>>
>>TIA
>>
>>Luis

Hi, thanks to your investigation and another mine. I created a T-SQL function that really works to the second (I don't need millisecond-level accuracy) and UTC offset will always be -0500 (Lima).

Here it is
CREATE FUNCTION [dbo].[fn_RetJsonDate](@tdFechHora datetime)
	RETURNS varchar(40)
AS
BEGIN
	DECLARE @cJsonDate varchar(40);
	DECLARE @nMiliSeg bigint= 1000;
	SELECT @cJsonDate= '/Date('+ CONVERT(varchar(40), DATEDIFF(SS, '19700101', @tdFechHora)* @nMiliSeg)+ '-0500)/';
	RETURN @cJsonDate;
END;
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform