Coldfusion: Convert euro date to us date - coldfusion

I have a date picker sending string dates in Euro format, e.g. 02/12/2011 (December 2, 2011). However, when I try to prepare the date in US format so the database can deal with it, e.g.
dateformat(LSDateFormat(form.startDate),'yyyy-mm-dd')
or
dateformat(form.startDate,'yyyy-mm-dd')
it convolutes the date to 2011-02-12 (February 12, 2011).
Does anyone have a solution that can handle dates - either as strings or date objects.
Cheers,
Paul

How does this work for you:
<cfscript>
euDateArr = ListToArray(form.startDate, '/');
dateObj = CreateDate(euDateArr[3], euDateArr[2], euDateArr[1]);
</cfscript>

Related

Convert date isoString "2022-12-20T21:20:23.500Z" to format DD/MM/YYYY hh:mm in Athena sql

This is my actual date data
I would like to know if someone has the knowledge or knows how to format this date as mentioned in the title, I have already tried too many things, but I cannot solve it.
I would appreciate your help or contribution
2022-12-20T21:20:23.500Z -> 20/12/2022 21:20
Update:
if it helps anyone then i did this:
date_format( from_iso8601_timestamp('2009-10-30T17:59:55.047) at time zone 'UTC', '%d/%m/%Y %H:%i') as expiredate
It is ISO 8601 timestamp format.
Please first check data type then if it string you can convert it to date by
select from_iso8601_timestamp('2009-10-30T17:59:55.047') from mytable
https://queirozf.com/entries/presto-athena-examples-date-and-datetime-functions#convert-string-to-datetime-iso-8601-timestamp-format
Then you convert date datetype to any format you want

Change string "dd/mm/yy HH:mm:ss" into accepted date/time format

I have a very rare date format dd/mm/yy HH:mm:ss that reads in as a string and I want to transform it into a date/time format PowerBI will accept. I managed to change the format into "dd/mm/yyyy HH:mm:ss", but now I have to switch the day part with the month.
How can I do this or is there an easier solution to my problem?
Select the column of date_time and change the data type from column tools to Date/time(pic 1) and after that select the format(pic 2) from column tools
pic_1
pic_2

Power BI text to date in "mmm-yy" format

I have an excel file having a column with Text format values like Jan-18, Dec-19, Feb-20. I want to convert it to a date format but when I am trying to make this column a date format it printing 1/18/2021, 12/19/2021,2/20/2021. Basically its considering Jan as month(1), 18 as Date, & making all year as 2021 deafult.
Can someone help?
Original(text) After Date conversion Desired format
Jan-18 1/18/2021 01/01/2018
Feb-19 2/19/2021 01/02/2019
Mar-20 3/20/2021 01/03/2020
You can try,
DATE(2018, MONTH(convertedDate), 1)
This will convert your converted date to the first day of the relevant month in 2018. This is stored in Power BI as a datetime object. If you want to show that value in dd/MM/yyyy format you can do it by selecting correct Format in the top menu.
If you load in the Original column as text, try this trick:
Desired format = DATEVALUE ( "1-" & [Original] )
Appending the "1-" to the beginning gives it a day of the month and forces it to recognize the last digits as the year.
I faced with the same issue , while changing the format instead of using Date use the last option i.e "Using Locale... " -> in that change the Data Type from Text -> Date, and Locale to English(United Kingdom) -> Hit ok. Earlier Format ,What should be the desired format .This worked for me!

Extracting day in a new field from a date in Pentaho

I have a field with a date in yyyy-MM-dd format, I want to extract the day only, for example, if the date is 2014-01-25, I want to have "25" in a new field. I used step "Calculator" is calculation "day of month of date A" but I get 1970-01-01 01:00:00 for all records.
Could someone tell me what might be the reason?
Before you actually have the Calculator step, have a Select Values step and make sure the date field is Date by explicitly giving the Date data type and specify the format it is currently in.

Start Date should be todays date and end date should be todays date plus one month

I have a requirement, Ii have date slicer i have created the date dimension
Start Date = CALENDAR (DATE ( 1900,1, 1), DATE (2025,12, 31))
Now I have kept the slicer for this it shows like this 1/1/1900 - 12/31/2025
but the end user want to see the start date with default todays date i.e. 01/02/2019 start date & end date.JPG
and end date should show as 02/02/2019 instead of 12/31/2025.
Can anybody suggest me how can I approach this requirement?
Not quite sure what you're after.
If you're asking for to set a default value for a slicer, that's not possible yet. Upvote this at: Slicer default selected values
Also, when you're using DATES, please use the right syntax, for example:
dd.MM.yyyy
yyyy.MM.dd
Other relevant information that could solve what I think you're after: https://www.fourmoo.com/2017/10/03/power-bi-did-you-know-all-power-bi-services-servers-are-in-utc-now-how-to-handle-it-for-dates-times/