on 2018 Nov 22 8:04 AM
How to get current date time in UTC+0, by simply any BODS function?
Found that there is BODS function "local_to_utc", but it is not used, as local time zone, or job server time zone is unknown in my scenario.
Date time should not be get from database, as it is highly dependent on DB connection.
SQL('MYSQL_DB', 'SELECT UTC_TIMESTAMP');
Request clarification before answering.
How about using sysdate() to get current system date time, then use local_to_utc()?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tried with below script. But it printed out date time in UTC+1, instead of UTC+0.
Second parameter (<timezone of the input with UTC offset>) in function local_to_utc is unspecified, as time zone is unknown for my scenario.
#Script for demo
$V_CURRENT_UTC_DATE_TIME = local_to_utc(sysdate());
print('$V_CURRENT_UTC_DATE_TIME=' || to_char($V_CURRENT_UTC_DATE_TIME, 'yyyy.mm.dd hh24:mi:ss'));
I want current date time in UTC+0.
Can it be done?
Is there any suggestion for this question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there any suggestion for below question?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Glad to know "$V_CURRENT_UTC_DATE_TIME = local_to_utc(sysdate(), 'UTC-04:00');"
can return current date time in UTC+0 due to job server located in time zone UTC-4:00.
For day light saving, I don't see a better way other than manually change it to UTC-03:00.
I didn't find any function to pick up time change due to day light saving. Sorry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this:
$V_CURRENT_UTC_DATE_TIME = local_to_utc(sysdate(), 'UTC+00:00');
See if this result is what you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Below script does NOT return current date time in UTC+0.
$V_CURRENT_UTC_DATE_TIME = local_to_utc(sysdate(), 'UTC+00:00');Below script return current date time in UTC+0, for job server that located in time zone UTC-4:00.$V_CURRENT_UTC_DATE_TIME = local_to_utc(sysdate(), 'UTC-04:00');
But it is not preferred way, as i have to modify the 2nd parameter in this function to UTC-3:00, when day light saving is started.User | Count |
---|---|
74 | |
30 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.