How to get UTC time in FME 2014? TimeStamper gives local time >>
When in DateTimeCalculator I'm subtracting hours from local time to get UTC time, but this won't work after Daylight Saving Time begins.
How to get UTC time in FME 2014? TimeStamper gives local time >>
When in DateTimeCalculator I'm subtracting hours from local time to get UTC time, but this won't work after Daylight Saving Time begins.
Not an answer to your question I'm afraid, but if you have the chance to update to FME 2019 that would be highly recommended, the date/time functionality is vastly improved in recent versions.
Not an answer to your question I'm afraid, but if you have the chance to update to FME 2019 that would be highly recommended, the date/time functionality is vastly improved in recent versions.
Yeah, I know it's easy to pull it in 2019. But I need to get UTC in 2014...
I'm not sure this works in your timezone, but Tcl has a function to convert a local time to other timezone including UTC. Try setting this expression to the Tcl Expression parameter in the TclCaller. Assuming the input "timeposition" (local time in your machine) is formatted with the ISO standard date/time format (%Y-%m-%dT%H:%M:%S).
clock format aclock scan dFME_GetAttribute timeposition] -format %Y-%m-%dT%H:%M:%S] -format %Y-%m-%dT%H:%M:%S -timezone :UTC
See here to learn more about the clock command in Tcl: https://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm
And available timezone names are here: https://wiki.tcl-lang.org/page/timezone
Again, I don't know if Tcl supports your timezone with daylight saving time. Please make enough test.
I have a solution but it requires a couple more steps in your process. Not super elegant but it works.
We occasionally use a date reference table in a database to determine daylight savings, Then reference the table to determine how to calculate time. Subtract or add so many hours depending upon start and end of daylight savings. The number of hours to add or subtract is dependent upon your time zone.
You could always create a spreadsheet with something similar. Compare to dates in the spreadsheet and in your transformation(s) say IF datetimenow()>dst_start and datetimenow()<dst_end then +- hours.
We reference the year then determine. Here is a snippet of our table.
Best wishes.
I'm not sure this works in your timezone, but Tcl has a function to convert a local time to other timezone including UTC. Try setting this expression to the Tcl Expression parameter in the TclCaller. Assuming the input "timeposition" (local time in your machine) is formatted with the ISO standard date/time format (%Y-%m-%dT%H:%M:%S).
clock format aclock scan dFME_GetAttribute timeposition] -format %Y-%m-%dT%H:%M:%S] -format %Y-%m-%dT%H:%M:%S -timezone :UTC
See here to learn more about the clock command in Tcl: https://www.tcl.tk/man/tcl8.5/TclCmd/clock.htm
And available timezone names are here: https://wiki.tcl-lang.org/page/timezone
Again, I don't know if Tcl supports your timezone with daylight saving time. Please make enough test.
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
@fikusas , are you still using FME 2014?
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
Yeah, still using FME 2014. There's no doubt how to do it in newer versions.
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
Not sure whether this will work in 2014, I think it should. But you can use an InlineQuerier to return UTC
e.g.
select datetime('now') as utc
Worth a try
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
It works, but returns no geometry. I'm reading some points and need to assign UTC time to those points.
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
I'm not sure with your workflow whether you can generate the utc time with the inline querier then merge onto your points, alternatively you can extract your point geometry to an attribute and then rebuild it again after the inlinequerier.
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
How do I select attributes and generate UTC time in the same querry? This doesn't work:
SELECT "beginposition","endposition","timeposition","datetime('now') as utc"
FROM Output
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
SELECT "beginposition","endposition","timeposition",datetime('now') as utc
FROM Output
Remove the double quotes from the datetime('now') part
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
It works! Thank you.
This worked for some time, but stopped recently. Maybe it is possible convert local time (with Daylight savings adjusted) to UTC via Python script?
If "beginposition", "endposition" and "timeposition" are attributes contained by input features, try this query.
SELECT *, datetime('now') as utc
FROM Output