How to Convert Date format MM/DD/YY to YYYY/MM/DD ?

deepaksb

Member
Hi,

I need to convert date in format MM/DD/YY to date field of 10 length with format YYYY/MM/DD.

I have string ready in format YYYY/MM/DD but not able to convert to date in same format. I tried using BSFN "B74I0010 - Convert String to Date using Format Mask" by passing mask as "EOA" but still it is converting string into date format "MM/DD/YYYY'.

for this bsfn I am passing 8 length string "YYYYMMDD" by removing special characters from string "YYYY/MM/DD" .

Please help.
 

JMR

VIP Member
I am confused...where do you want to use your YYYY/MM/DD date?

That function you're calling will convert a string to a JDE date.
If you're then trying to 'view' that date in an application or a report, the formatted output of that date depends, I believe, on your user profile settings which could point to OS settings.

If you want to display that date in a format of your choosing, your output needs to be a plain text field, not a JDE date variable. You will also need to find a business function (I don't know one off the top of my head) that performs the following API and takes a format mask parameter:

Code:
FormatDate( szOutputDate, jdInputDate, szOutputFormatMask );

It sounds like you already have the date in your desired output format in a text field...just use that for your output.
If you want your actual date variable fields to display in a certain format without changing a user's default date format or the system date format, I suppose you could try writing a display rule business function and overriding your variable's display rule on an individual APPL or UBE basis (or at the data item level).
 
Last edited:

johndanter

Legendary Poster
Knock yourself out, my personal notes on dates over the years

Can I suggest you install ObjectBrowser and just mess about with anything with the word Date you find in F9862:


Date Manipulation BSFN within JDE

First day of the month
VA evt_StringFirstDayMonth = concat("01",substr(date_today(),2,8))



Convert String to a date (N0800640)






· Get week of the year

N0501033 DeriveWeeksMonthsYearsFrom2Dates

Set From date to 01/01/XX

To date = today

Eg 20/09/2013 = 37.42th week of the year



· Get Week of Month

B0130151 GetWeekOfMonth

Use a date to yield both month of year and week of that month





· BSFN – Convert String to Date DDMMYY - B76A8015

DL01 Þ szStringtoConvert

DRQJ Ü mnDay



BSFN – Convert Date to String – B9800460
DRQJ Þ jdDatetoConvert

DL01 Ü sxDateConvertedtoString



BSFN - User Date, Format - B0000078
This BSFN can perform in 2 modes.

(2) Û mnMonth DMTM

(2) Û mnDay DMTD

(2) Û mnYear DMTY

(2) Û mnCentury DMT#

(6) Û jdReturnDate DATE01

‘ ‘ / ‘1’ Þ cProcessingFlag

Pass a blank ‘ ‘ to bring back the date from the bits.

Pass a ‘1’ to bring back the bits from the passed in date.



01-Mar-08 Format Dates
User Date, Format

VA rpt_BirthdateMonth <- mnMonth

VA rpt_BirthdateDay <- mnDay

VA rpt_BirthdateYear <- mnYear

UNDEFINED X mnCentury

BC Date - Invoice - Julian -> jdReturnDate

"1" -> cProcessingFlag

Date Format Month Description

VA rpt_BirthdateMonth -> mnCalendarMonth

VA rpt_MonthDescriptionDESC <- szDescription

RV InvoiceDateDL01 = concat([VA rpt_BirthdateDay],concat('-',concat([VA rpt_MonthDescriptionDESC],concat('-',[VA rpt_BirthdateYear] )) ))



BSFN – Format Date from Day Month Year - B41B0470
This BSFN only brings BACK a 6 digit date from the D M Y components.

(2) Þ mnYear

(2) Þ mnMonth

(2) Þ mnDay

(6) Ü jdDate



BSFN – Separate Year and Century from 4 byte ye - N0700400
(6) Þ jdDate

(2) Ü mnCentury

(2)? Ü mnYear



BSFN - Retrieve Correct Century - B0000154
Based on a cut off year, CENTCHG, say 50

FY Þ mnFiscalYear

(2) Ü mnCentury

(4) Ü mnCenturyYear



BSFN - F0008 Get Fiscal Date Pattern - B0000167
Use this BSFN to bring back period start dates and the actual Tax year etc.

T / R Þ cFiscalDatePattern

G/L Þ jdDateforG/L

(2) Ü mnCentury

(2) Ü mnYear

(2) Ü mnPeriodNo

……loads of other stuff (Period start dates etc)







where you encounter dates in substr commands please perform the following

VA evt_VC10A_StringDate6 = substr([VAvt_SGLMSGDATA_MessageData],201,6)

Call ConvertStringToDate_DDMMYY - B76A8015

Value
Dir
Parameter

VA evt_VC10A_StringDate6
>
szStringtoConvert

VA evt_MMEJ_jdExpirationDate
<
jdDatecoverted






BSFN - User Date, Format - B0000078
This BSFN can perform in 2 modes.

(2) Û mnMonth

(2) Û mnDay

(2) Û mnYear

(2) Û mnCentury

(6) Û jdReturnDate

‘ ‘ / ‘1’ Þ cProcessingFlag

Pass a blank ‘ ‘ to bring back the date from the bits.

Pass a ‘1’ to bring back the bits from the passed in date.



BSFN – Format Date from Day Month Year - B41B0470
This BSFN only brings BACK a 6 digit date from the D M Y components.

(2) Þ mnYear

(2) Þ mnMonth

(2) Þ mnDay

(6) Ü jdDate



BSFN – Separate Year and Century from 4 byte ye - N0700400
(6) Þ jdDate

(2) Ü mnCentury

(2)? Ü mnYear



BSFN - Retrieve Correct Century - B0000154
Based on a cut off year, CENTCHG, say 50

FY Þ mnFiscalYear

(2) Ü mnCentury

(4) Ü mnCenturyYear



BSFN - F0008 Get Fiscal Date Pattern - B0000167
Use this BSFN to bring back period start dates and the actual Tax year etc.

T / R Þ cFiscalDatePattern

G/L Þ jdDateforG/L

(2) Ü mnCentury

(2) Ü mnYear

(2) Ü mnPeriodNo

……loads of other stuff (Period start dates etc)



· F0008 Get fiscal Period Number – X0903

Use this BSFN to bring FY info for a CO based on todays date in Julian



CO Þ szCompany

G/L Þ jdDateforG/L

(2) Ü mnPeriodNo

(2) Ü mnYear

(2) Ü mnCentury









where you encounter dates in substr commands please perform the following

VA evt_VC10A_StringDate6 = substr([VAvt_SGLMSGDATA_MessageData],201,6)

Call ConvertStringToDate_DDMMYY - B76A8015

Value
Dir
Parameter

VA evt_VC10A_StringDate6
>
szStringtoConvert

VA evt_MMEJ_jdExpirationDate
<
jdDatecoverted






· BSFN - Convert String Date to Format – B0800208

Date back Ü jdConvertedDateJulian

StringDate VC10A Þ szStringtoConvert

Mask Þ szFormatMask



Masks Available (stored in UDC 00 DF)

Mask
Description

D
Day Number, 1 or 2 digits.

A
Day Number, ZERO pad to 2 digits.

Y
Day Number, space pad to 2 digits.

M
Month Number, 1 or 2 digits

O
Month Number, ZERO pad to 2 digits.

N
Month Number, space pad to 2 digits.

T
Month Number, by language, from UDC

B
Abbreviated Month Name, by language, from UDC.

R
2 Digit Year.

E
4 Digit Year

S
Date slash character, from configuration

C
Date comma character, from configuration.
 
Top