Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
why am i getting the '0' value in vHour variable using Today() function?
I don't think you need dollar sign expansion here (you would need it in a LOAD statement, not necessarily in control statements or LET variable assignment).
Let vToday = Now();
Let Hour = Hour(vToday);
vToday | 31.01.2017 20:09:10 |
---|---|
vHour | 20 |
You need to use dollar sign expansion:
LET vToday = Today();
LET vHour = Hour($(vToday));
The vHour will still be equal to 0 because Today() uses 12:00 AM for its timestamp. If you want the current timestamp, you'll want to use now():
LET vToday = Now();
LET vHour = Hour($(vToday));
Hi Nicole,
Thank you for the quick reply but can you please specify why should i use Dollar sign expansion and I cannot see the hour value based on the day like Today?
Or just
LET vHour = Hour(Now())Today();
Hi Sunny,
Your answer is still giving me 0 in vHour variable but in vToday variable it is giving me date and time.
In the load script, you need to use dollar sign expansion to get the value in a variable.
As for the hour, Today() will return '2017-01-31 00:00:00.000' while Now() will return the timestamp of when it is called (i.e. '2017-01-31 10:49:03.386').
I don't think you need dollar sign expansion here (you would need it in a LOAD statement, not necessarily in control statements or LET variable assignment).
Let vToday = Now();
Let Hour = Hour(vToday);
vToday | 31.01.2017 20:09:10 |
---|---|
vHour | 20 |
Let vHour = Hour(Now()); is giving 0? Really?
Good to know swuehl. Thanks for the correction!
Hi stefan,
Thank You so much for the information and your answer worked for me.