Tibco xpath daylight saving issue - dst

Does anyone here knows how to solve the Tibco xpath daylight saving date issue.
The issue was we have one record 03/10/2013 02:00 parsed via Tibco mapping palette with following format (mm/dd/yyyy hh:mm). However, it got invalid date time error with above date. It worked with all other times, e.g. 03/10/2013 01:00, 03/10/2013 03:00, just not working with anytime between 03/10/2013 02:00 ~ 03/10/2013 02:59.
The current xpath we using parse-dateTime(format, string)
So, can xpath detect the daylight saving automatically with the inbound date format (mm/dd/yyyy hh:mm) and parse it?
Thanks so much.
James

Yes. The TIBCO function that parses dateTime does detect Day Light Saving.
I think you have two options to handle these cases in your engine.
Change the code to have a Java Code parse the dateTime. I am aware
that java correctly returns the time with 1 hour added in this case.
You should be able to do a TimeZone.getDefault() to get the server's
default TimeZone.
Change the java default timezone in the TRA - java.property.user.timezone in the designer.tra I suppose.
I have not tried these. :-)

I had the same problem with DST, trying to parse string 2014-03-30 02:00:00 which does not exist in italian timeZone.
Since the input date was perfectly legit (intended to be in GMT+0) I solved by forcing the timezone with this code. It should work with any other timezone as long as it doesn't support DST.
tib:parse-dateTime("yyyy-MM-dd HH:mm:ss Z"), concat($Start/root/dateTimeFrom, ' +0000')

Enable daylight in deployment.yaml (kubernetes)
- name: BW_JAVA_OPTS
value: "-Dbw.engine.enable.memory.saving.mode=true -Xms1024m -Xmx4096m"

Related

Date Format for API 4.0

When attempting to send an event via post to your api in version 4, I am sending
"data"=>
{"id"=>"bfc50100-02eb-11e9-b178-db8890d0b369",
"name"=>"Name of Event",
"type"=>nil,
"description"=>nil,
"start_epoch"=>1343815200,
"end_epoch"=>1343869200,
"archived"=>0,
"deleted"=>0,
"is_public"=>0,
"status"=>"ACTIVE",
"has_time"=>1,
"timezone"=>nil,
"legacy_id"=>nil,
"created_at"=>"2018-12-18T17:38:36.000Z",
"updated_at"=>"2018-12-18T17:38:36.000Z",
"industry"=>nil}}
And receiving success from your API, but when going to the url for this event, I am seeing the date formatted as 1/18/70, though in Unix time this should be showing as 8/1/2012.
This occurs with all dates. Am I missing something? Is there another date format you would like? The term epoch led me to believe that you wanted a standard unix timestamp.
you need to send unix time stamp, e.g., 1545326867 - which is in milliseconds

Snapchat API Error: "The start time should be start of a Local Time Zone day for DAY query."

I am making following request for Snapchat API:
GET https://adsapi.snapchat.com/v1/ads/7e4ebe9a-f903-4849-bd46-c590dbb4345e/stats?
granularity=DAY
&fields=android_installs,attachment_avg_view_time_millis,attachment_impressions,attachment_quartile_1,attachment_quartile_2,attachment_quartile_3,attachment_total_view_time_millis,attachment_view_completion,avg_screen_time_millis,avg_view_time_millis,impressions,ios_installs,quartile_1,quartile_2,quartile_3,screen_time_millis,spend,swipe_up_percent,swipes,total_installs,video_views,view_completion,view_time_millis,conversion_purchases,conversion_purchases_value,conversion_save,conversion_start_checkout,conversion_add_cart,conversion_view_content,conversion_add_billing,conversion_searches,conversion_level_completes,conversion_app_opens,conversion_page_views,attachment_frequency,attachment_uniques,frequency,uniques,story_opens,story_completes,conversion_sign_ups,total_installs_swipe_up,android_installs_swipe_up,ios_installs_swipe_up,conversion_purchases_swipe_up,conversion_purchases_value_swipe_up,conversion_save_swipe_up,conversion_start_checkout_swipe_up,conversion_add_cart_swipe_up,conversion_view_content_swipe_up,conversion_add_billing_swipe_up,conversion_sign_ups_swipe_up,conversion_searches_swipe_up,conversion_level_completes_swipe_up,conversion_app_opens_swipe_up,conversion_page_views_swipe_up,total_installs_view,android_installs_view,ios_installs_view,conversion_purchases_view,conversion_purchases_value_view,conversion_save_view,conversion_start_checkout_view,conversion_add_cart_view,conversion_view_content_view,conversion_add_billing_view,conversion_sign_ups_view,conversion_searches_view,conversion_level_completes_view,conversion_app_opens_view,conversion_page_views_view
&swipe_up_attribution_window=28_DAY
&view_attribution_window=1_DAY
&start_time=2018-10-05T00:00:00.000-08:00
&end_time=2018-10-19T00:00:00.000-08:00
Getting following Error:
{
"request_status": "ERROR",
"request_id": "5bf3f47e00ff060ab0faf7f4330001737e616473617069736300016275696c642d30666635373463642d312d3232302d350001010c",
"debug_message": "The start time should be start of a Local Time Zone day for DAY query.",
"display_message": "We're sorry, but the data provided in the request is incomplete or incorrect",
"error_code": "E1008"
}
Certain date ranges will work and others won't. It also doesn't matter what timezone offset (Europe/London +00:00, Los Angeles, -08:00) I use or how I format the request dates (2018-10-01T00:00:00Z, 2018-10-01T00:00:00.000, 2018-10-01T00:00:00.000-08:00, etc) for the ad stats request date range, the error will come back the same. The error has a code but it's not detailed in Snapchat's documentation. All they say is "it's a bad request".
For example, one ad would let me query 29/10/2018 to date or even 29/10/2018 to 30/10/2018 but as soon as I change it to 28/10/2018, it fails with the same error.
There's no apparent start/end times on ads as I thought it might be related to that. It's also not related to the campaign start/end times in this one case we tested.
API DOC: https://developers.snapchat.com/api/docs/?shell#overview
Solved the issue with above error. I forgot to consider the day light saving while passing the timezone offset.
For e.g. We need to check if there is day light saving for the start_time or end_time and adjust the offset accordingly for that timezone.

Why does the code below return 4:14 PM instead of 3:14 PM?

I'm trying to convert a UTC to a CST by using the 'ConvertTimeFromUtc' method. However, the result is off by 1 hour compared to what I got when I try to convert it manually online.
StatusDatetime is 2017-06-05 21:14:39.6216795
TimeZoneInfo.ConvertTimeFromUtc(StatusDatetime.Value,
TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time")).ToString("hh:mm
tt")
Try using Central Daylight Time instead of Central Standard Time, as we are in daylight savings time.

VB difference between windows file hour and VB file hour

How to obtain the date from a file without the influence of windows time settings ?
I'm trying to read date file with VB but I obtain a difference between the time writes on file properties (WDT) and the time returns by VB (VBT), due to daylight saving time
If I read a file saved during winter time in summer, I have a difference of VBT = WDT+1h. And in the same case, if I read a file saved during summer in winter, I obtain a difference of VBT = WDT-1h.
You need to convert the DateTime(s) to UTC and compare those times. This is the time without any adjustment for daylight savings, etc.
There is an extension of the DateTime type ToUniversalTime that returns the UTC value:
https://msdn.microsoft.com/en-us/library/system.datetime.touniversaltime(v=vs.110).aspx
Example:
Dim currentDateTime = DateTime.Now
Debug.WriteLine(currentDateTime.ToString)
Debug.WriteLine(currentDateTime.ToUniversalTime.ToString)
Outputs on my machine (UK Time Zone +1h from UTC for British Summer Time)
15/04/2016 12:21:04
15/04/2016 11:21:04
Note that there is also a DateTime.UtcNow if you want the current system time directly in UTC

What time zone is S3Object.getObjectMetadata().getLastModified()?

I am trying to get the last modification time of a file in S3 using the ObjectMetadata method getLastModified(), as in the following snippet of code:
S3Object s3obj= some_s3_object;
Date someDate = s3obj.getObjectMetadata().getLastModified();
// What time zone is someDate in?
I'm getting back a value, but I am wondering what time zone it is in, and if I can rely on that being in the same time zone? I can't find a reference to the time zone in the docs or anywhere else - maybe I missed it somewhere?
In the course of using the debugger to examine the actual date value, I discovered the fact that the Date's TimezoneOffset is actually set to PST which is the locale of the server.