In Solr Index the format of my date-field is "2014-06-27T10:25:56.204Z" as expected. I can see this when calling: /solr/admin/luke?wt=xslt&tr=luke.xsl&fl=description&numTerms=200&docId=2
Anyhow the format of my date-field coming from Solritas (the default ResponseWriter) is Fri Jun 27 10:25:56 CEST 2014.
I can't find the location, where this transformation happens in order to change the format of the date-field according to my needs.
I haven't found the source of format change yet, but I know how to change the format anyhow:
#set($myDate = $doc.getFieldValue('myDate'))
$date.format("d. MMM. yyyy, h:mm",$myDate)
Related
We recently did an upgrade on our CRM to version 7.12.5 (I'm not sure what version we upgraded from). Previously, on the API, the dates I'd be looking at were always in +00:00 (GMT). I.e., 01-01-2023T13:00:00Z-00:00. This is a correctly formated ISO8601 datetime representing Jan 1st 2023, 1PM, in GMT.
Now they are like 01-01-2023T13:00:00-05:00. Except that the 13:00:00 part is actually the GMT time stored in the MYSQL database. So it's like a GMT time, with a -05:00 timezone slapped onto it. This makes no sense to me.
An example- I create a record at 13:00:00 EST. In MariaDB, it displays correctly as 18:00, but when I look at the record in an API call, it displays as ...T18:00:00-05:00.
EDIT: There's also situations where the date_entered and date_modified fields are in two different timezones(?!). I.E.:
"attributes": {
...,
"date_entered": "2018-09-17T13:38:00-04:00",
"date_modified": "2020-02-27T16:12:00-05:00",
...
}
Previously, these were ALL in -00:00.
Any idea on why this could be? I don't have full admin access on this server but I may be able to provide more information if needed.
In SQL server, I have a date string that looks something like 09/08/2021. Representing dd/MM/YYYY. So in this case its 09 August 2021. Every method I attempt converting this explicitly into a date format automatically converts this to 2021-09-08. So SQL incorrectly converts to 08 September 2021.
SELECT TRY_CAST(Convert(VARCHAR(15),'09/08/2021',103) as date);
SELECT TRY_CAST(Convert(VARCHAR(15),'09/08/2021',111) as date);
Both incorrectly give:
2021-09-08
Desired result is:
2021-08-09
I've tried the various different versions of the above but keep getting the incorrect conversion. I don't really want to go down the road of changing the source data either.
I am amazed no similar question has been previously asked regarding this.
How can this be converted explicitly using functions in SQL Server?
As per the comments, it was the conversion that was the mistake. Adjusted to
TRY_CONVERT(DATE, '09/08/2021', 103)
This fixes the issue.
I'm trying to convert the date format 2017-08-07 08:42:08 to format Mon Apr 19 1976 0:59:00 using react-moment library.
I went through the docs at [https://www.npmjs.com/package/react-moment][1] and tried similar examples, but nothing fits my need exactly.
I can do:
<Moment fromNow>{datetime}</Moment>
yields format:
in 10 days
But
<Moment unix>{datetime}</Moment>
yields
Invalid date
<Moment parse="YYYY-MM-DD HH:mm:ss">
{datetime}
</Moment>
yields: Mon Aug 07 2017 08:47:47 GMT+0545. I don't it without the timezone value at the end. What's the correct parameter for this date format from this input?
Moment can parse most standard date formats. Use the parse attribute to tell moment how to parse the given date when non-standard.
https://github.com/headzoo/react-moment#parsing-dates
You can set the output in whatever format you want. Check out the table of possible tokens. Choose the tokens you need and set them on the format attribute. Here's some examples:
<Moment
format="YYYY-M-D H:m:s"
parse="YYYY-MM-DD HH:mm:ss"
>2017-08-18 11:01:21</Moment>
With localization:
<Moment
format="LL LT"
parse="YYYY-MM-DD HH:mm:ss"
>2017-08-18 11:01:21</Moment>
With time from now:
<Moment
fromNow
parse="YYYY-MM-DD HH:mm:ss"
>2017-08-18 11:01:21</Moment>
Sandbox example.
As per documentation in npm default format that you want. Because that default format of js, as mentioned in w3schools
<Moment format="Here desire format">{datetime}</Moment>
*optional: Please try to install moment-timezone as mentioned in the link.
Here I have done it using momentjs library
code
output
Few days back I have started working on solr, and today I am facing a problem with deltaQuery.
my server timezone is IST also mysql is giving default output in IST.
but solr dataimport.properties file storing the timezone in UTC.
Problem is when I selecting the query B.modified_on >'${dataimporter.last_index_time}' then wrong time comparing because of timezone.
the solr logs are:- B.modified_on>'2016-09-23 07:39:10' and the server time is.
$ date
Fri Sep 23 15:22:20 IST 2016
Please suggest how to change solr timezone in IST or any other answer. I cann't my linux server timezone.
Solr logs by default are in UTC. To change this to IST, edit the solr.in.sh file to include the line:
# By default the start script uses UTC; override the timezone if needed
SOLR_TIMEZONE="IST"
You can use the CONVERT_TZ function in MySQL to convert a datetime field to UTC.
CONVERT_TZ(B.modified_on, 'IST', 'UTC') > '${dataimporter.last_index_time}'
.. should work. Try it in a MySQL command line session to see that you're getting the correct UTC time back.
I'm connecting to an MS SQL database via Power Query (Version: 2.10.3598.81) in Excel 2010.
My dates are stored in UTC in the database, however I would like to show them as local in the spreadsheet.
DateTimeZone.From() - converts to a DateTimeZone type but assumes the input date is in the Local timezone. This is the exact opposite of what I want.
DateTimeZone.ToLocal() - gives an error, I think because there's no timezone information in the source date.
Local in my case is Australian EST, however it would be great if Excel just picked up the local timezone. (It appears to do this already)
I think I've discovered the answer.
The function DateTime.AddZone() which I thought was used to convert between timezones is actually used to add timezone information to an existing date. If your date is UTC you would use DateTime.AddZone([date_created],0) and if your date was already in AEST then you would use DateTime.AddZone([date_created],10).
So I can now use:
DateTimeZone.ToLocal(DateTime.AddZone([date_created_UTC],0))
and Power Query will correctly convert my date created from UTC to AEST (or whatever is local).