Convert a cell to TimeStamp w Time zone as parameter for SQL Query in Excel 2007 - sql

so my query has
where date_trunc('DAY', mh.end) > ?
However when I try to put stuff like "3/31/2012 12:00:00 AM" or "2012-01-31" in the cell, it complains about it not being Timestamp with TIMEZONE format. How can I get it to accept the date? I have been trying to search but I have not found other people having this problem (my search terms might have been off).

Ok I figured it out. I had to convert the date to Text using =TEXT(B1,"yyyy-mm-dd hh:mm:ss") After that it works fine

Related

Why are the minutes disabled in vue-ctk-date-time-picker?

I am using the vue-ctk-date-time-picker to display a date time picker modal where users can pick date and time. I use a minDate such that users cannot pick date and time less than the current date and time. This works perfectly with format YYYY-MM-DD HH:mm:ss, but I needed the AM and PM format so I changed the format to YYYY-MM-DD HH:mm a. Now, the PM equivalent of the AM date is also being disabled.
For example, its 8:30 AM, so the picker disables all minutes upto 30 and users can only select 31, 32 and so on. But if I select PM, the minutes are still disabled, ie, the users are only able to pick from 31, when its not even PM yet.
Has anyone faced this problem? Is there a problem with package itself?
For anyone else having this problem, this is the solution according to the document here: https://github.com/chronotruck/vue-ctk-date-time-picker#behaviour
In order to avoid having too much properties in the component, We're
adding a behaviour property that is an object including some annex
behaviour values.
The default value for this object is:
{
time: {
nearestIfDisabled: true;
}
}
To override those values, pass a new object with the values you want
to override:
<ctk-date-time-picker
:behaviour="{
time: {
nearestIfDisabled: false
}
}"
/>

I want to create U.S. Date Format to Indian Date Format Using Asp MVC Core 2.0

I am trying to Create Date Format the US to Indian Date Format like(dd/mm/yyyy hh:mm tt).
When I run the code on my local machine it works.
When we publish and fetch values from the server at that time it shows "US" Date Format(mm/dd/yyyy)
How τo do the internal conversion, in Appsettings.json what strings i need to mention.
public static DateTime ConvertIndianDateFormat(DateTime usTime)
{
DateTime dateTime = DateTime.Now;
TimeZoneInfo usEasternZone = TimeZoneInfo.FindSystemTimeZoneById("US Eastern Standard Time");
TimeZoneInfo indianZone = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
DateTime usEasternTime = TimeZoneInfo.ConvertTimeFromUtc(usTime, usEasternZone);
DateTime indianTime = TimeZoneInfo.ConvertTimeFromUtc(usTime, indianZone);
return indianTime;
}
This is because you are probably using something like DateTime.Now for C# and if you have an SQL Server you are using GETDATE(). It's not like an issue with application.json or something. The above functions return the machine datetime, thus why locally on your pc the time is correct and incorrect if you upload it to a server.
So make sure that the time is correct. If you are uploading to servers in another country then you will probably have a different time and/or format.
How you proceed depends on your needs:
Is the time correct?
Then simply reformated it or store it specifically using
DateTime.Now.ToString("dd/mm/yyyy hh:mm tt") // this is not the correct format.
Do you want to serve multiple clients in multiple regions/countries?
Then you should store the time as UTC and cast it based on clients date format. For example the server could be in USA and someone from UK would view a different time than his own which would be weird.
DateTime.UtcNow
Generally your problem could be large or small depending on your needs

Searching date and time in Lucene query string in Cloudant

I am trying to write the index and search using date and time in that index in Cloudant NoSql database.
When I pass only the date in the query string, it works fine
created_date:[2015-08-16 TO 2015-08-27]
This returns the correct results but when I include time in the parameter:
created_date:[2015-08-16 07:38:00 TO 2015-08-27 07:38:02]
I get an error:
Cannot parse 'created_date:[2015-08-16 07:38:00 TO 2015-08-27 07:38:02]': Encountered " "TO" "TO "" at line 1, column 50. Was expecting one of: "]" ... "}"
I have some more query parameters before this but the above is the gist of the error.
This is an Apache Lucene query string. What is causing this to happen?
According to Lucene Java doc, date format should looks like this:
A date field shall be of the form 1995-12-31T23:59:59Z The trailing
"Z" designates UTC time and is mandatory
This format was derived to be standards compliant (ISO 8601) and is a
more restricted form of the canonical representation of dateTime from
XML schema part 2. Examples...
1995-12-31T23:59:59Z 1995-12-31T23:59:59.9Z 1995-12-31T23:59:59.99Z
1995-12-31T23:59:59.999Z
So, you miss 'T' between date and time.
For more information: https://lucene.apache.org/solr/4_10_4/solr-core/org/apache/solr/schema/DateField.html
I did it the following way
created_date:["2015-08-16 07:38:00" TO "2015-08-27 07:38:02"]
and used the keyword analyzer in cloudant
This link explains it all
https://lucene.apache.org/core/2_9_4/queryparsersyntax.html

MS SQL Server - convert(datetime, string, code) -> What code for dd/mm/yyyy hh:mm:ss (24hours)?

I would to CONVERT this string 08/12/2014 16:46:12 to a datetime but I do not know what code to use and it is driving me crazy. I looked on many pages but do not find it
CONVERT(datetime,'08/12/2014 16:46:12',???)
Thank you in advance
Parameter 131 is incorrect, because it uses the Hijri calendar - 2014 becomes 2576.
Use 103 as style parameter instead:
convert(datetime,'08/12/2014 16:46:12',103)
Despite the documentation on http://www.w3schools.com/sql/func_convert.asp it also converts the time value (tested on SQL Server 2014 and 2008 Express).
convert(datetime,'08/12/2014 16:46:12',13)
OR
convert(datetime,'08/12/2014 16:46:12',113)
One Last GO :)
SELECT CONCAT ((convert(datetime,'08/12/2014,103)),' ',(convert(datetime,'16:46:12',114))) AS DateTime
Here is a list of them all http://www.w3schools.com/sql/func_convert.asp

Splunk date comparison

I need to be able to search for log entries with a specific start date, which has nothing to do with _time. The format is, for example, Start_Date: 08/26/2013 4:30 PM.
I need to add a condition in my search to specify the date, but not the time. I tried strptime and strftime unsuccessfully.
For example, I tried converting start date to a string (without time) and compare it to another string:
"08/26/2013"=strftime(Start_Date, "%d/%m/%Y")
This didn't work either:
"08/26/2013"=strftime(strptime(Start_Date "%d/%m/%Y %I:%M %p"), "%d/%m/%Y")
Any ideas how to solve this?
A * did the trick: Start_Date=08/26/2013*
Answer here: http://answers.splunk.com/answers/100630/splunk-date-comparison