I'm not sure if it's an ISO date or not. When I read email from a pop server, one of the fields is called "date", and it has a string that looks like this:
19 Jun 2012 18:02:09 -0400
Q: Is there a routine to convert this date to a ColdFusion date variable?
I created two variables.
thisdate = "19 Jun 2012 18:02:09 -0400";
thisdate = "19 Jun 2012 18:02:09";
I ran them through this conditional statement.
if (isDate(thisdate)) {
writeOutput("It is a date!");
} else {
writeOutput("It is NOT date!");
}
The first one is NOT a date. The second is a date.
Perhaps you could just look the "-0400", which is probably an offset.
You could manipulate the date to create the type of date that you really want.
newDate = dateFormat(thisdate, "full");
writeOutput(newDate);
newTime = timeFormat(thisdate, "full");
writeOutput(newTime);
You can try this UDF from cflib site
Related
Good Afternoon,
For a project I need a method to show with a year filter which rows were active in that year based on a start and an end date.
Example dates:
25th Oct 2019 - 14th Jul 2022
1st Feb 2020 - 1st Jan 2022
25th May 2016 - 24th May 2018
With A filter on 2020 this would mean:
Show
Show
Don't show
I have an approach that works but it only works if you enter a specific date as a filter. My measure works like this:
I have a separate datetable that I use as a filter, this value is stored in the variable selDate, and the isActive variable checks whether this variable date falls in between.
My DAX code:
Find_active_row =
var selDate = SELECTEDVALUE(Dates[Date])
var isActive if(and(selDate>=firstdate(Table[Startdate]),selDate<=firstdate(Table[enddate])),1,0)
return isActive
So my problem is I want to filter by year and now I need to filter a specific day for it to work. I'm actually looking for a replacement for firstdate because this doesn't work if I make Table[Startdate].year because it won't be a date field anymore. I hope my problem is clear and any help is appreciated :)
I have a character variable which contains dates like (string length is 30):
Mon Jul 24 02:48:17 -0700 2017
------------------------------ ruler
123456789012345678901234567890
1 2 3
How can I extract the usable(date,month,year) date and save it as numeric date. I know how to do it by using SUBSTR function and then concatenating everything together. But I want to know a easier and quick way. I tried using ANYDTDTE informat to read it, but got blank values. Let me know if there is any simpler way to read this date.
Do you need just the date? Or do you need to get the time part also? The SCAN() function can make this easier.
data test;
str='Mon Jul 24 02:48:17 -0700 2017';
date=input(cats(scan(str,3),scan(str,2),scan(str,-1)),date9.);
format date date9.;
datetime=input(cats(scan(str,3),scan(str,2),scan(str,-1),':',scan(str,4,' ')),datetime20.);
format datetime datetime19.;
run;
Result:
str=Mon Jul 24 02:48:17 -0700 2017
date=24JUL2017
datetime=24JUL2017:02:48:17
I have been using a SAS code I have written to group a historical dataset (that gets updated weekly) by grouping them into weeks (Sunday - Saturday = 1 group). I have been using INTNX.
Our definition of a week has now changed and is Tuesday through Monday. How can I update the code below to make that adjustment. I have been messing with the 'Week' function and trying to add days to the end to make this change but to no success.
Currently, I am using:
WEEKOF = INTNX('Week', SasDate,0);
Where "SasDate" is the date of each record in my dataset.
Any help would be greatly appreciated.
Thanks,
Michael
Simply change it to
weekof = intnx('week.3',sasdate,0,'beginning') ;
Sun = 1, Mon = 2, Tue = 3, etc.
I am having a issue with my DS.Model parsing dates in the format of "YYYY-MM-DD". They are always one day behind.
Here is an example:
http://jsfiddle.net/ZUV8v/
Using Date objects on the console I get similar results
> new Date('2012-09-20')
Wed Sep 19 2012 17:00:00 GMT-0700 (PDT)
Is this a ember bug or a javascript bug or a Chrome bug or am I missing something?
Chrome Version 21.0.1180.89 on OSX 10.7
I ran into this just the other day.
According to the ECMAScript Specification 15.9.1.15
All numbers must be base 10. If the MM or DD fields are absent "01" is used as the value. If the HH, mm, or ss fields are absent "00" is used as the value and the value of an absent sss field is "000". The value of an absent time zone offset is "Z".
new Date('2012-09-20')
is the same as
new Date("2012-09-20T00:00:00.000Z")
The console then outputs the value in your local timezone.
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>