Kirjaudu
Google-sovellukset
Päävalikko
Post a Comment On:
Programming Solution
"Progress 4GL/Open edge Code to fetch First and Last date of any month."
No comments yet. -
1 – 0 of 0
In the below example we have fetched the First and Last Date of the current month, you can customized it and can use as per your requirement.
Define variable date1 as date no-undo.
Define variable date2 as date no-undo.
run Default_date.
Message "First Date of Current Month" date1 " ----" " Last Date of Current Month " date2 view-as alert-box.
PROCEDURE Default_date:
Define variable m_session as character no-undo.
Assign
m_session = SESSION:DATE-FORMAT.
IF INDEX (m_session , "m") = 2 THEN
do:
IF INDEX (m_session , "y") = 3 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date("01" + "/" + String(Month(Today)) + "/" + String(YEAR(TODAY)))
date2 = date("01" + "/" + String ( ( Month(Today) + 1 ) ) + "/" + String ( YEAR(TODAY)) ) - 1.
else
Assign
date1 = date("01" + "/" + String(Month(Today)) + "/" + String(YEAR(TODAY)))
date2 = date("01" + "/" + "01" + "/" + String ( YEAR(TODAY) + 1 ) ) - 1.
End. /*(m_session , "y") = 3*/
IF INDEX (m_session , "y") = 1 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date( String(YEAR(TODAY) ) + "/" + String ( Month(Today) ) + "/" + "01")
date2 = date( String(YEAR(TODAY) ) + "/" + String ( Month(Today) + 1 ) + "/" + "01") - 1 .
Else
Assign
date1 = date( String(YEAR(TODAY) ) + "/" + String ( Month(Today) ) + "/" + "01")
date2 = date( String(YEAR(TODAY) + 1 ) + "/" + "01" + "/" + "01") - 1 .
End. /*INDEX (m_session , "y") = 1*/
End. /*INDEX (m_session , "m") = 2*/
IF INDEX (m_session , "m") = 1 THEN
do:
IF INDEX (m_session , "y") = 3 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date( String ( Month(Today) ) + "/" + "01" + "/" + String ( YEAR(TODAY) ) )
date2 = date( String ( Month(Today) + 1 ) + "/" + "01" + "/" + String ( YEAR(TODAY) ) ) - 1.
Else
Assign
date1 = date( String ( Month(Today) ) + "/" + "01" + "/" + String ( YEAR(TODAY) ) )
date2 = date( "01" + "/" + "01" + "/" + String ( YEAR(TODAY) + 1 ) ) - 1.
End. /*(m_session , "y") = 3*/
IF INDEX (m_session , "y") = 2 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date( String ( Month(Today) ) + "/" + String ( YEAR(TODAY) ) + "/" + "01" )
date2 = date( String ( Month(Today) + 1 ) + "/" + String ( YEAR(TODAY) ) + "/" + "01" ) - 1.
Else
Assign
date1 = date( String ( Month(Today) ) + "/" + String ( YEAR(TODAY) ) + "/" + "01" )
date2 = date( "01" + "/" + String ( YEAR(TODAY) + 1 ) + "/" + "01" ) - 1.
End. /*INDEX (m_session , "y") = 2*/
End. /*INDEX (m_session , "m") = 1*/
IF INDEX (m_session , "m") = 3 THEN
do:
IF INDEX (m_session , "y") = 1 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date( String ( YEAR(TODAY) ) + "/" + "01" + "/" + String ( Month(Today) ) )
date2 = date( String ( YEAR(TODAY) ) + "/" + "01" + "/" + String ( Month(Today) + 1 ) ) - 1 .
Else
Assign
date1 = date( String ( YEAR(TODAY) ) + "/" + "01" + "/" + String ( Month(Today) ) )
date2 = date( String ( YEAR(TODAY) + 1 ) + "/" + "01" + "/" + "01" ) - 1 .
End. /*INDEX (m_session , "y") = 1*/
IF INDEX (m_session , "y") = 2 then
do:
IF Month(Today) <> 12 THEN
Assign
date1 = date( "01" + "/" + String ( YEAR(TODAY) ) + "/" + String ( Month(Today) ) )
date2 = date( "01" + "/" + String ( YEAR(TODAY) ) + "/" + String ( Month(Today) + 1 ) ) - 1 .
Else
Assign
date1 = date( "01" + "/" + String ( YEAR(TODAY) ) + "/" + String ( Month(Today) ) )
date2 = date( "01" + "/" + String ( YEAR(TODAY) + 1 ) + "/" + "01" ) - 1 .
End. /*INDEX (m_session , "y") = 2*/
End. /*INDEX (m_session , "m") = 3*/
END PROCEDURE.
posted by slayer at
2:05 AM
on Sep 13, 2016
Leave your comment
You can use some HTML tags, such as
<b>, <i>, <a>
This blog does not allow anonymous comments.
Google Account
You will be asked to sign in after submitting your comment.
Please prove you're not a robot
"Progress 4GL/Open edge Code to fetch First and Last date of any month."
No comments yet. -