i am trying something llike this <https://trycf.co...
# cfml-beginners
g
i am trying something llike this https://trycf.com/gist/462c2ac14c5824f0ca606ca58c0e059c/lucee5?theme=monokai where i should be able to get if its morning, it should returning me morning and if afternoon and then that and if evening then evening
b
@gsr I wouldn't use dateDiff(). I'd just get the hours from the UTC date and then create if statements to decide whether it's morning, noon, or night.
Copy code
dateConvert( 'local2Utc', now() ).hour()
That will give you a number 0-23 representing a 24 hour clock
s
I THINK the reason you're getting the result you're getting is because if you don't specify a date, it doesn't assume today, it assumes epoch start, iirc, so to do it the way you're currently doing it, you need to create a full datetime with today's date and the time, not just the time, for the third parameter.
...but Brad's way is obviously easier. 🙂
g
@bdw429s i am getting 0 for every value, if i use now or even use local2utc, it is giving me 0
s
hour(now()) is saying 1 right this minute, but when you typed that, it was between midnight and 1am UTC, so 0 was correct.