Oracle sql in NetSuite - type-conversion

I am trying to convert Jan 2017 to a date of 1/1/2017 and I am hitting so many roadblocks. I can get it to be a text value of '1/1/2017' with a {formula} but when I try to do to_date({formula},'MM/DD/YYYY') it just gives an error.
Any thoughts?

This is not exactly what you are asking for... But, why not use the NetSuite String to Date function? If you are trying to write to a date field in NetSuite, that function will provide you with the date that you are looking for.
var startDate={formula}; //No idea what your formula is. But, you said this returns 1/1/2017;
var newDate=nlapiStringToDate(startDate);
NetSuite Date APIs

Related

I am getting error in Power BI while changing Date Type

Everyone, I am currently doing a project in Power BI but I am getting errors.
While transforming data initially, in Power Query, when I change the data type from (Text) to type (date), it only shows 2021 at the end of every date, like this 1/18/2021.
Even before it was date of 2019 like jan-19 but after only shows this. 1/18/2021 for every date. So please someone can help me?
It's assuming the 18/19 refer to the day of the month rather than the year. Try replacing "-" with "-20" before converting to date using the Transform > Replace Values tool.
Table.ReplaceValue(Source,"-","-20",Replacer.ReplaceText,{"Date"})

Why is my MongoDB Realm GraphQL endpoint returning date like this and how do I parse it in the client

I'm using MongoDB Realm which generates a GraphQL server on top of your data. It only allows primitive types in the resolver return type so I had to return the date as a string.
For some reason my date is coming back in this format 0001-01-01 23:00:00 +0000 UTC and I cannot parse it with moment.
What is this format called and how am I supposed to fix this? I don't know the name of the format to even find out how to return it correctly.
Any help would be greatly appreciated.
Thanks
That doesn't look like any of the typical formats. It looks like some hybrid of iso8601 and the traditional Unix date/time format.
I suggest examining the serialization code that produces this value to explicitly specify the desired format (such as iso8601).
You could alternatively fudge it in the frontend by replacing the first space with T, deleting the second space and everything following and appending Z to arrive at 0001-01-01T23:00:00Z which should parse as iso8601.

How to handle UK date format string (dd-mm-yyyy) in SSRS report?

It should be a easy problem but surprisingly I could not find a useful answer so please bear with me.
So I fetch the date string(dd-mm-yyyy) from SQL and because the column is nvarchar so what I get is a string data type.
What I need is to convert it to date data type and surprisingly it is harder than I can imagine in SSRS report. It seems there is not any build-in function can easily handle the UK format date string.
For example, if I do CDate("26/03/2018") it will convert nicely but if I do CDate("03/26/2018") it will give me error.
My current solution is to convert the type in SQL but I prefer not to handle the presentation in SQL.
I tried to change language culture and calendar in SSRS but none of them worked.
Converting the date in SQL is by far the best way in my opinion. People get hung up about what should go in the presentation layer but this isn't presentation anyway, you're modifying data.
Anyway, if you really want to do this in SSRS, you can with something like this
=DateSerial(
RIGHT(Fields!myUKDate.Value,4),
MID(Fields!myUKDate.Value,4,2),
LEFT(Fields!myUKDate.Value,2)
)

Tableau cannot recognize timestamp field in my log file

I am using Tableau 9.3 to do a preliminary data analysis on one of my log file, the log file is like below:
"199.72.81.55",01/Jul/1995:00:00:01,/history/apollo/,200,6245,Sat
As you can see, there is a datetime for timestamp
In Tableau, initially it is recognized as a string like below:
That's fine, I want to make the field into datetime, and Tableau seems failed on it:
Why? How do I fix it?
Thank you very much.
UPDATED: after applying the formula suggested below, Tableau still cannot recognize the timestamp, here is the screenshot:
UPDATED AGAIN: after tested by nick, it is confirmed his first script is correct and working on his Tableau, why it fails on mine, I don't know, you are welcome to share any clue please, thank you.
Tableau implicit conversions are limited to more standard formats. You can still create a DATETIME field from your timestamp string using a calculated field with the following formula:
DATEPARSE('dd/MMM/yyyy:HH:mm:ss',[timestamp])
Using the above will transform a string like 01/Jul/1995:00:00:01 to a date and time of 7/1/1995 12:00:01 AM
Output using example data:
Sometimes the "date parse" function in Tableau doesn't quite do the job.
When this happens it is worth testing manual string manipulation with your timestamp field to put it into ISO-standard format and only then trying to convert it into a date. ISO format is yyyy-mm-dd hh:mm:ss (eg 2012-02-28 13:04:30). It is common to find that the original string has spurious characters or spaces that throw dateparse. But these are usually easy to manipulate away with suitable text manipulations. This can sometimes be longwinded, but it always works.
It turned out to be the region setting issue, it works after I switch it to USA

Date and timezone using j2me

I have a date string as input from an rss like:
Wed, 23 Dec 2009 13:30:14 GMT
I want to fetch only the time-part, but it should be correct according to the my timezone. Ie, in Sweden the output should be:
14:30:14
What is the best way? I want it to work with other RSS date formats as well if possible. Im using regexp right now but that is not very general.
Im having a hard time finding any library or support for dates and timezones in j2me?
/Br Johannes
In normal Java, I'd use a SimpleDateFormat object (that you create to match the pattern of the date you're getting in the RSS) to parse the String value and give you a Date object. Then, using a Calendar (which would be localized to your time zone), you'd be able to get the hour, minute, and second information.
I don't know j2me, but a google search suggests that these classes are available in j2me.