Toad World® Forums

Need to extract YYYYMM from YYYY/MM


#1

I have been given a table with a date field that is in the YYYY/MM (e.g., 2018/07) format and I need to get this in the YYYYMM (i.e., 201807) format. I’m using Toad for Oracle 12. Thanks in advance for any help you may provide.


#2

SUBSTR(date_field,1,4)||SUBSTR(date_field,5,2) my_date

On Fri, Jul 6, 2018 at 1:59 PM, pghscott8 bounce-pghscott8@toadworld.com wrote:

Need to extract YYYYMM from YYYY/MM

Thread created by pghscott8
I have been given a table with a date field that is in the YYYY/MM (e.g., 2018/07) format and I need to get this in the YYYYMM (i.e., 201807) format. I’m using Toad for Oracle 12. Thanks in advance for any help you may provide.

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for Oracle Forum notifications altogether.

Toad for Oracle - Discussion Forum

Flag this post as spam/abuse.


Gene L. Bradley Jr.

Systems Analyst

Office of Information Technology

Jackson State University

1400 J R Lynch Street

P.O. Box 17750

Jackson, MS 39217

ph 601.979.1042

fax 601.371.9146

email gbradley@jsums.edu

*In God we trust; all others bring data. * ~W.E. Deming

CONFIDENTIALITY STATEMENT

This electronic transmission is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (601) 979-1042. Thank you.


#3

My previous answer was for if date_field is varchar

If it is actually a date format see below

TO_CHAR(date_field,'MMMMYY) my_date

On Fri, Jul 6, 2018 at 1:59 PM, pghscott8 bounce-pghscott8@toadworld.com wrote:

Need to extract YYYYMM from YYYY/MM

Thread created by pghscott8
I have been given a table with a date field that is in the YYYY/MM (e.g., 2018/07) format and I need to get this in the YYYYMM (i.e., 201807) format. I’m using Toad for Oracle 12. Thanks in advance for any help you may provide.

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for Oracle Forum notifications altogether.

Toad for Oracle - Discussion Forum

Flag this post as spam/abuse.


Gene L. Bradley Jr.

Systems Analyst

Office of Information Technology

Jackson State University

1400 J R Lynch Street

P.O. Box 17750

Jackson, MS 39217

ph 601.979.1042

fax 601.371.9146

email gbradley@jsums.edu

*In God we trust; all others bring data. * ~W.E. Deming

CONFIDENTIALITY STATEMENT

This electronic transmission is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (601) 979-1042. Thank you.


#4

Thanks, Gene. That was exactly what I needed. Have a great weekend!

From: gene.l.bradley [mailto:bounce-genelbradley@toadworld.com]

Sent: Friday, July 06, 2018 3:09 PM

To: toadoracle@toadworld.com

Subject: RE: [Toad for Oracle - Discussion Forum] Need to extract YYYYMM from YYYY/MM

RE: Need to extract YYYYMM from YYYY/MM

Reply by gene.l.bradley

My previous answer was for if date_field is varchar

If it is actually a date format see below

TO_CHAR(date_field,'MMMMYY) my_date

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or
Unsubscribe from Toad for Oracle Forum
notifications altogether.

Toad for Oracle - Discussion Forum

Flag
this post as spam/abuse.


#5

No Problem

On Fri, Jul 6, 2018 at 2:31 PM, pghscott8 bounce-pghscott8@toadworld.com wrote:

RE: Need to extract YYYYMM from YYYY/MM

Reply by pghscott8
Thanks, Gene. That was exactly what I needed. Have a great weekend!

To reply, please reply-all to this email.

Stop receiving emails on this subject.

Or Unsubscribe from Toad for Oracle Forum notifications altogether.

Toad for Oracle - Discussion Forum

Flag this post as spam/abuse.


Gene L. Bradley Jr.

Systems Analyst

Office of Information Technology

Jackson State University

1400 J R Lynch Street

P.O. Box 17750

Jackson, MS 39217

ph 601.979.1042

fax 601.371.9146

email gbradley@jsums.edu

*In God we trust; all others bring data. * ~W.E. Deming

CONFIDENTIALITY STATEMENT

This electronic transmission is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone (601) 979-1042. Thank you.