I'm New to salesforce reporting so i'm sure what i'm trying to get might be easy, but i'm not getting the results I want.
Basically I want to be able to extract the HOUR from a date/time field.
I have tried this:
VALUE(MID (TEXT (CREATED_DATE:UNIQUE), 12, 2))
But it gives me an '-' as an output rather then the actual hour.
Any idea as to what I might be doing wrong here?
Thank you!
Related
I'm attempting to understand what exactly date-fns is doing when using parseISO() as it seems to be adding 2 hours to the time that I have saved in the database. The data is as follows:
ISO Date/Time saved in database: 2022-09-20T19:52:53.000Z
Using format(parseISO(2022-09-20T19:52:53.000Z), "HH:mm:ss") I get this: 21:52:53 hrs
Somewhere along the line 2 hours are being added and unsure as to the cause. A comment left by Monash Joshi in (stackoverflow issue) hints towards an explanation but not really a solution. Want I want to show is just the parsed date/time value as it is. Would it thus make sense to manipulate the string that I receive from the database myself?
Thanks in advance for your help! And let me know if you need any further information.
I am relatively new to Solr and I am trying to achieve the following: get all records where a certain field matches the current date (e.g. 16/04/2021 00:00 to 16/04/2021 23:59).
I have looked at the docs, but there aren't many examples.
Could someone please point me in the right direction?
Thanks
Based on information in the Working with dates section of the reference guide:
datefield:[2021-04-16T00:00:00Z TO 2021-04-17T00:00:00Z}
The } and the end indicates "not inclusive", so everything up to, but not actually inside the next day. You could use .. TO 2021-04-16T23:59:59.999Z] or something similar as well, but it's probably better to be explicit.
I've seen a few posts on here and dotted around on the internet but I'm still struggling to implement my findings to get this to work.
I am currently trying to pull through a date field and run parameters on this field however everything I do fails and it still comes through as text or I experience an error.
Here is my current code:
SELECT CEL_SLT.ACCOUNT,
CEL_SLA.NAME,
CEL_SLT.STOCK_CODE,
**CEL_SLT.DATE**,
CEL_SLT.STOCK_QTY,
CEL_SLT.AMOUNT,
CEL_SLT.ORDER_NO
FROM Datafile.dbo.CEL_SLA CEL_SLA, Datafile.dbo.CEL_SLT CEL_SLT
WHERE CEL_SLA.ACCOUNT = CEL_SLT.ACCOUNT
AND ((CEL_SLT.STOCK_CODE Like 'F%' And CEL_SLT.STOCK_CODE Not Like 'FNX%')
AND (CEL_SLT.ACCOUNT=?)
I need the field CEL_SLT.DATE to come through as a date field.
I hope this makes sense and someone can help.
Assuming that your data is clean (in other words, the text data actually looks like a date), you can do it with either the CAST or CONVERT command.
SELECT CAST(CEL_slt.DATE as date)
OK, so, here's an odd one, which is causing me to lose what little hair I have left.
We have some code that uses ADO to pull data from SQL Server. The code's been in place for 7 or 8 years now, and hasn't been touched for quite a while.
In the function, where we check the returned field's type for some conversion, we have this:
case ( fieldType = ADDBTIMESTAMP$ )
* // A date/time stamp (yyyymmddhhmmss plus a fraction
* // in billionths)
* // Looksd like we're just getting MM/DD/YYYY
* // ooh no sometimes we get 6/25/2010 11:35:00 AM
Basically, this is saying that when the field's type is ADDBTIMESTAMP (or 135), then for whatever reason, the date is being returned MM/DD/YYYY sometimes with, and sometimes without a time stamp.
This morning, all date fields are now returning values YYYY-MM-DD (dashes included).
I haven't changed this code. The network people swear up and down that they haven't updated or modified SQL Server. My workstation is Win10, so who knows what's changed on that, but I don't see any indication of updates for the past few days.
Obviously, something's changed, considering we're now getting the data back in a what should be the correct format, but for the life of me, I can't see what could have happened.
Any help or tips or psychiatric recommendations would be appreciated.
Thanks.
Basically, it's a configuration issue on the workstation I'm using. No other workstation appears to have the problem. I don't think I'll ever find out what happened. To be honest, now that I've looked at the code, which I've never needed to before, I'm more concerned that it's always been returning wrong on every machine for the last 7 or 8 years.
It's things like this that make me want to go into a less stressful line of work, like opening a restaurant.
Thanks.
Help solve the problem. It is impossible to produce the amount of the grouped fields. I can only add up all the fields. What I want to get the show on the link below.
http://habrastorage.org/files/99c/5df/f1f/99c5dff1f34e4d1a9e51e3769a65b18f.png
PS Sorry for my English, I use translate.google.
In order to help with something like this, it would be good to see a code snippet which you are using. This would give an idea of where the data is coming from and what format the data is.