I'm new to Crystal Reports, I'm trying to extract and display month and year from the string (In DB the data type of the column is varchar). Following is an example of the data.
05-JAN-12 11.49.28.000000000 AM
I need it in following format
Jan-12
I have used cDate to convert the string to date format but was unsuccessful, maybe I didn't do it right way.
Alter the formula to extract the date portion, then convert it to a date:
DateValue(Split("05-JAN-12 11.49.28.000000000 AM")[1])
Apply formatting to the field as desired.
This may work
Date (Year ({reportfield}) * 10000 + Month ({reportfield}) * 100 + Day ({reportfield}))
Then format the field to display the date as your choosing.
MonthName(DatePart ("m", <<Date field>>))+"-"+totext(DatePart ("yyyy", <<DAtefield>>),0,"")
Related
I have a column containing dates in the following format: "28-SEP-2018 12.40.00", does anyone know how to extract the month and year from the date in a new column (i.e. Sep- 2018), via producing a measure.
#navee1990 the measure to extract the date and year is as follows
= MONTH([date] & YEAR([date])
Or the long way
CONCATENATE(MONTH([date]),YEAR([date]))
Assuming the type of the column is Text and you want the new values to be displayed as SEP-2018 rather than 09-2018:
You would need to create a new column with DAX as c1 = MID(Table2[Column1],4,8)
In case if the column is of type: DateTime ; then use the below DAX for new column :FORMAT(Table2[Column1],"MMM-YYYY")
New Date =FORMAT([date], "MMM") & "-" & YEAR([date])
This would give you a column with text data type. You can further create a column to sort the New Date column as per calendar chronology.
I am trying to extract a month from a date in SAS, but so far all my new month variables are coming up as missing.
I have attempted to use some combinations of the month() function in SAS, but so far it just comes up as missing. The dates are formatted as follows: 01/31/2017 (MMDDYY10.)
I have tried
month = month(end_date)
Month =catx('/',put(month(end_date),z2
I would like the Month to show up as a number (01) or a 3 letter code (JAN), currently it is just missing (.)
Thanks in advance!
For month() to return a missing value the end_date variable must be numeric and missing. If end_date were a character variable the log would show invalid numeric data.
Use the monname3. format to convert a date value to a $3. character value mon
monthname = put (end_date, monname3.);
Other alternatives are:
keep the date value unchanged and change the format, or
map the date value to the first of the month value and also format that
For example:
end_date_copy = end_date;
format end_date_copy monname3.;
end_date_month = intnx('month', end_date, 0);
format end_date_month monname3.;
What you ultimately do depends on how the mon is to be used downstream in reporting or aggregating.
Column 1 : I have this date-time format in one column = 2018-10-08T04:30:23Z
Column 3 : I extracted date with formula = =LEFT(A11,10) and changed column format to date.
Column 32 : today(). Just to make sure both date columns match
Now when I want to compare both dates
Column 4 : =IF(C11=D11,TRUE(),FALSE())
It does not work. What did I do wrong?
One option using formulas only would be to use Excel's DATE function, which takes three parameters:
=DATE(YEAR, MONTH, DAY)
Use the following formula to extract a date from your timestamp:
=DATE(LEFT(A1,4), MID(A1,6,2), MID(A1,9,2))
This assumes that the timestamp is in cell A1, with the format in your question. Now, comparing this date value against TODAY() should work, if the original timestamp were also from today.
Should be worth trying:
=1*LEFT(A1,10)=TODAY()
May depend upon your configuration. Without format conversion (the 1*) you are trying to compare text (all string functions return Text) with a Number.
I have a data set with date format (which according to our IT it's an IBM format) 1110101 which means 1/1/2011, so 1160506 means 5/6/2016. I tried to convert it to date format that tableau can recognize and here's the plan:
Step 1, I create a field called "Date Converted"= Date I have + 19000000
Step 2, I use DATEPARSE to convert it to date by:
DATEPARSE("yyyymmdd",19000000+[Date I have])
But Tableau doesn't accept DATEPARSE and it says it's an unknown syntax. Anyone know's how to correctly convert IBM date format to a date that Tableau can recognize?
My date format
Change your format in string
Create custom calculation
MID([Date],6,2) + "/" + MID([Date],4,2) + "/" +MID([Date],2,2)
Change your data type to date
You date will look like this
i have a one field,i want to convert this date filed into date time format as following format in crystal report level.
Please suggest me formula for this
CdateTime({database_string_field})