Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6108697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:19:24+00:00 2026-05-23T14:19:24+00:00

So I need to add a timestamp in the result set if the record

  • 0

So I need to add a timestamp in the result set if the record falls in this condition.

Example:

  • Using todays date of “07-06-2011” as a comparison against a datetime, I need to add a timestamp to the result set if the record falls between the timestamps of MARCH 10th and APRIL 11th 2011

  • Using a timestamp of “08-01-2011″as a comparison against a datetime, I need to add a timestamp to the result set if the record falls between APRIL 10th and MAY 11th 2011

and so on…

Having trouble with the syntax of the and how to calculate the specific dates, Any Ideas?

Example Data running for date: “07-06-2011”

  • any date for the month of July should work but the March 10, 2011 and April 11, 2011 should stay the same until August. Then it should be the next two concurrent months

.

date_feild       new_date_feild
------------     --------------
"03-09-2011" 
"03-15-2011"     "07-06-2011"
"04-10-2011"     "07-06-2011"
"04-15-2011      

Pseudo Query:

SELECT date_feild, CASE
    WHEN date_field BETWEEN (three months ago on the 10th) AND (two months ago on the 11th)
    THEN NOW() AS new_date_feild
END
FROM tbl_name
WHERE other_conditions

I guess I would like to know how to get these dates in this format:

  • three months ago on the 10th
  • two months ago on the 11th

UPDATE:

Well I have concocted this mess of a query, can anyone else help it along?

SELECT TO_DATE(
    TEXTCAT(
        TEXTCAT(
            TEXTCAT(
                date_part('YEARS', CURRENT_DATE - INTERVAL '3 MONTHS'),
            '-'),
        date_part('MONTHS', CURRENT_DATE - INTERVAL '3 MONTHS')),
    '-10'),'YYYY-MM-DD') AS previous_date,
TO_DATE(
    TEXTCAT(
        TEXTCAT(
            TEXTCAT(
                date_part('YEARS', CURRENT_DATE - INTERVAL '3 MONTHS'),
            '-'),
        date_part('MONTHS', CURRENT_DATE - INTERVAL '3 MONTHS')),
    '-10'),'YYYY-MM-DD') + INTERVAL '1 MONTH' + INTERVAL '1 DAY' AS next_previous_date
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:19:25+00:00Added an answer on May 23, 2026 at 2:19 pm

    Well here is what I have but I’m not really happy with it:

    SELECT TO_DATE(
        TEXTCAT(
            TEXTCAT(
                TEXTCAT(
                    date_part('YEARS', CURRENT_DATE - INTERVAL '3 MONTHS'),
                '-'),
            date_part('MONTHS', CURRENT_DATE - INTERVAL '3 MONTHS')),
        '-10'),'YYYY-MM-DD') AS previous_date,
    TO_DATE(
        TEXTCAT(
            TEXTCAT(
                TEXTCAT(
                    date_part('YEARS', CURRENT_DATE - INTERVAL '3 MONTHS'),
                '-'),
            date_part('MONTHS', CURRENT_DATE - INTERVAL '3 MONTHS')),
        '-10'),'YYYY-MM-DD') + INTERVAL '1 MONTH' + INTERVAL '1 DAY' AS next_previous_date
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two lists: ask[] timeStamp[] I need to add the information in these
I need to add to my message something like this: <soap:Header> <wsse:Security xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd soap:mustUnderstand=1>
I need to add working hours to a timestamp. Working hours are from 8am
I need add a new user group for mediawiki. The new group has more
need to add a 2nd css stylesheet to a page. do i add a
I need to add a new stored procedure on our company's MySQL server. Since
I need to add break line in some legend in JFree Chart. I have
I need to add a web part zone to a wiki page. I'm opening
I need to add DVD writing functionality to an application I'm working on. However
I need to add role based permissions to my Rails application, and am wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.