Date Format in file name

I have this query
SELECT file_prefix ||'_'||file_name||'_'||TO_CHAR(TO_DATE(sysdate, 'DD-MON-YYYY'),'RRRRMMDD')||'_THRU_'||TO_CHAR(TO_DATE(sysdate -1,
'DD-MON-YYYY'),'RRRRMMDD')||'.txt' file_path
FROM payment_schedule
WHERE payee_id = 2
AND payment_period_from = 1;
The result set i am expecting is
Sales_Commissions_20100310_THRU_20100309.txt
but the result i am getting is
Sales_Commissions_00100310_THRU_00100309.txt
It show up as 00 instead of 20 in the date field.
Thanks in advance

>
SELECT file_prefix ||'_'||file_name||'_'||TO_CHAR(TO_DATE(sysdate, 'DD-MON-YYYY'),'RRRRMMDD')||'_THRU_'||TO_CHAR(TO_DATE(sysdate -1,
'DD-MON-YYYY'),'RRRRMMDD')||'.txt' file_path
FROM payment_schedule
WHERE payee_id = 2
AND payment_period_from = 1;
>
Here you are using TO_DATE(sysdate,...) that seems to be a common mistake we see in this forum. sysdate is returned as a DATE datatype so there is no need to TO_DATE() it. In fact, it can result in all sorts of errors and corrupt data.
Instead you probably want something more like
SELECT file_prefix||'_'||file_name||'_'||
       TO_CHAR( sysdate, 'YYYYMMDD')||
       '_THRU_'||TO_CHAR( sysdate -1, 'YYYYMMDD')||
       '.txt' AS file_path...

Similar Messages

  • Date appended to file name

    Hi
    I want to append date to my attachement name, to achieve this I went to scheduling and scheduled my report and gave attachment name as my_file_%y%m%d as specified by Tim in his blog (http://blogs.oracle.com/xmlpublisher/2009/12/dynamic_delivery_file_naming.html), but it is just giving the characters as they are instead of year month date appended to file name, my output is excel and our environment is standalone BIP.
    Anyone help me on this.
    Edited by: user8937215 on Sep 2, 2010 7:04 AM

    Please check if the thread Re: Can I append date to the file name using Bursting helps

  • Can I append date to the file name using Bursting

    Hi All,
    I know that we can append date to the file using %y, %m and %d for
    Email
    FTP
    WEBDAV
    But is there any way of appending the date to the file name if I am bursting my file to a shared location.
    I tried that %y, %m and %d but that doesn't work for bursting.
    Please reply
    Thanks,
    Ronny

    If this requirment is for EBS, please refer the following blog
    http://blogs.oracle.com/BIDeveloper/2010/08/xdoburstrpt_passing_parameters.html
    For standalone see the following delivery sql query as example.
    select
    d.department_name KEY,
    'Standard' TEMPLATE,
    'RTF' TEMPLATE_FORMAT,
    'en-US' LOCALE,
    'PDF' OUTPUT_FORMAT,
    'FILE' DEL_CHANNEL,
    'C:\Temp' PARAMETER1,
    d.department_name||'_'||to_char(sysdate,'mmddyyyy')|| '.pdf' PARAMETER2
    from
    departments d
    Thanks
    Ashish

  • How to add YYMMDD format date to the file name

    Hi,
    I need genrate the file with date suffixed to its name in YYMMDD format. The add time stamp is adding it till YYYMMDD-HHMMSSS.
    How can I change this format to the required one? Any suggessions.
    Thanks.
    Sri

    hi,
    you can create the whole filename (whatever you need)
    in the mapping (in a UDF) using adapter specific message attributes
    there are many blogs describing how to do that Dynamic Configuration of Some Communication Channel Parameters using Message Mapping
    Regards,
    Michal Krawczyk

  • Append date to exporting file name in SQL reporting service

    When exporting a report to another format, say excel,PDF; the file name is always set to the report name. Our client has a requirement where whenever a user exports a report to pdf, the timestamp of when the data of the report was made should be appended in the filename. Is there a way to do this in Reporting Services as well as report builder?
    example : Report name : Testreport
    Exported file should be : Testreport-November-22-20076.pdf
    please help me in this
    Thanks
    suku

    Hi,
    I know it's been while since this question was posted. I am replying so that it'll be useful for other people when they come across this same situation.
    If you have access to SQL Server Agent to create jobs then this idea will be helpful -
    1. Connect to your Report Server from SSMS.
    2. Note the ItemID for your report by executing this query
    select *
    from ReportServer..Catalog
    where Path like '%NameofyourReport%'
    3. Create a job in here with the name say "AppendDatetoxyzreport" and add a step in it with the code
    UPDATE [Catalog]
    SET [Path] = '/PathofyourrerportfromReportServer/ReportName_' + CONVERT(VARCHAR(8), GETDATE(), 112),
    [Name] = '/ReportName_' + CONVERT(VARCHAR(8), GETDATE(), 112)
    WHERE ItemID ='<ItemID>'
    4. Create another job with a name like "RemoveDatexyzreport" and add a step in it with the code
    UPDATE [Catalog]
    SET [Path] = 'PathofyoureportinReportserver/ReportName',
    [Name] = 'ReportName''
    WHERE ItemID = '<ItemID>'
    5. Now set your AppendDatetoxyzreport job schedule to execute first, then the Report's subscription and then the RemoveDatexyzreport.
    By doing this the first job changes the name to include present date, then you get you report and the next job sets it back to its previous name.

  • File-File - Need to extract data from source file name???

    Hello Experts,
    I have a unique situation. In my file to file scenario, the source file name is of the format XYZ_yymmddHHMM.dat. there is field in the target file which has to filled with the date that is there in the file name of the source file (yymmdd). How can this be achieved? Normally we do the other way round using vaiable substitution where we can name a file depending on the value in any of the target field structure.
    Please help.
    Regards,
    Yash

    Hi,
      please prepare the udf with the following code.
      i mean, dynamic configuration concept.
      where u get the file name, then use substring function to capture date from right side.
       //write your code here
    // getFileName User Defined Function
    // function to create name of output file
    String filename;
    filename = strFile;
    try {
    // initialize DynamicConfiguration for create file with given name
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    //create file with the specified name
    conf.put(key, filename);
    } catch (Exception ex) {
    return filename;
    warm regards
    mahesh.

  • Can I script the changing of creation date, using the file name?

    Normally people are doing this in reverse, but let me paint the picture.
    I pulled 204 video files from an old HDD based JVC camera.  JVC records in .MOD format which iPhoto won't import.  I imported them into iMovie just fine, and iMovie even set the file name to clip-2007-11-04 04;42;29.mov which is great, but it now has a new creation date of whatever date I imported it.  Which then causes problem when I want the videos stored in iPhoto and sorted appropriately by creation date.
    I've used the application "A Better Finder Attributes 5" to individually edit the creation and modify, but I'm sure I don't want to do this 203 more times, as you can't just type in the date and time, you have to type in each part of the date/time, or select it on a calendar.
    I've used the application "Name Changer" to batch convert the file names to the format YYYYMMDDhhmm which would be helpful if I were going to use the terminal command touch -t, but again I don't want to have to type it in 203 more times, plus drag and drop the file into finder to populate the location.
    Now, if I were more handy with automator, or maybe some (any) scripting language this would be easy peasy.  I'd batch rename all the files to the YYYYMMDDhhmm.mov and then have a script that just took the file name, passed that to touch -t along with the file location, and a few seconds later, they would all be done!
    Anybody have any suggestions to how I can do this, and tips to what commands to use or ANY advice?  I'm more than happy to RTFM, but I have no idea which manual to read!
    Thanks

    If your file names are precisely as you have written, this script will do what you want.
    Copy the script into an AppleScript Editor document, select one or more files in a Finder window, return to the AS Editor and press Run.  Note: you will need to provide your password when the script runs.
    Make sure you have a backup of any files you are working on (try using duplicates first, perhaps). The script has no error handling.
    tell application "Finder"
              set FileList to selection
              repeat with theFile in FileList
                        set fileName to name of theFile
                        set filePath to quoted form of (POSIX path of (theFile as alias))
                        set crYear to text 6 thru 9 of fileName
                        set crMonth to text 11 thru 12 of fileName
                        set crDay to text 14 thru 15 of fileName
                        set crHour to text 17 thru 18 of fileName
                        set crMins to text 20 thru 21 of fileName
                        set crDate to crYear & crMonth & crDay & crHour & crMins
                        set shellString to "touch -t " & crDate & " " & filePath
      do shell script shellString with administrator privileges
              end repeat
    end tell

  • Append Date & Time to File name

    i have a folder name  LOG .  the  folder contains  a number of files. i want to append  the current date and time to each
    filename
    LOG
    PCone.csv
    PCTwo.csv
    PCThree.csv
    i want to add date time to each file in the folder 
    output should be 
    PCONE 2014-12-16 12:01:44.csv
    PCTwo.csv 2014-12-16 12:01:44.csv
    PCThree.csv 2014-12-16 12:01:44.csv

    I know this is probably to late for you but in case others have the same question use the following method:
    First example is for Universal Time (London)
    Get-Service | Export-Csv c:\temp\Services-$(((get-date).ToUniversalTime()).ToString("yyyyMMddThhmmssZ")).csv
    This example is for local time formatted the way I would want it:
    "c:\temp\Services-$((get-date).ToString('yyyy-MM-dd hh-mm-ss tt')).csv"
    Windows does not allow for a colon ":" to be used in a file name so you will need to choose a different separator. Frankly I'm fine with a hyphen "-" but that might just be me.
    The following artical will give you all the formatting options.
    https://technet.microsoft.com/en-us/library/ee692801.aspx

  • How to add Yesteday's date in AL11 File name ?

    Hi Experts,
    Can anyone please reply to my Query ?
    We have to generate the *.TXT file as an output of Open Hub Destination.
    For this the File Naming convention should be Yesterday's date + .TXT. ( for example if today's date is 27.07.2011 then the file name should be 20110726.TXT).
    Here I could generate the file name using <YYYY><MM><DD> for today's only ( 20110727.TXT). But We need to generate the Yesterday's date here..
    I tried to create the Function module ( FILENAME_EXIT_TEST) as suggested in F1 on that Physical Location input area. And I tried to give the Physical location as <F=FILENAME_EXIT_TEST>.TXT.
    But I'm getting the error as " The Function Module doesnot exist" or "Function Module FILENAME_EXIT_TEST is unknown".
    But I'm sure the FM is available and activated already.
    Could you please let me know, How to fix this issue.
    NOTE: I have created this Function Module with Export parameter as OUTPUT and DATS Associated type. In the Source code I have written as OUTPUT = SY-DATUM - 1.
    Edited by: jayaprakash j on Jul 28, 2011 2:30 PM

    Hi All,
    I got the solution.
    The code which i had written in the FM is wrong.
    OUTPUT = SY-DATUM - 1. // Wrong.
    The correct one is below :
    DATA: Temp TYPE SY-DATUM.
    Temp = SY-DATUM - 1.
    OUTPUT = Temp.
    And after that, in FM's Export tab, it should be Export parameter as OUTPUT and checked the "Pass value" check box.
    For the Physical File : <F=TEST>.txt.
    Here the FM which i created was FILENAME_EXIT_TEST.
    When I am calling the corresponding Logical file in the APD, It is working fine.
    Thanks for your inputs.

  • Setting Date value in File Name while scheduling report to File System

    I am trying to set the file name as %SI_Name% Current Date.extension in Destination section while scheduling a crystal report to File system.
    So in Use Specific Name section i have added %SI_NAME% %SI_STARTTIME%.%EXT%.
    Schedule works fine for me and I get the document in the file location with name  'Title 2009-06-26-12-53-17.pdf".
    But I dont want time to be printed in the title, so the title should be "Title 2009-06-26.pdf". How i can achieve this.
    -Raghu

    Is there any way to achieve this?
    -Raghu
    Edited by: Raghavendra Barekere on Jul 5, 2009 3:09 PM

  • How to auto save output with date added to file name, and email the results?

    Hi,
    We found a script to capture disk space usage, that automatically places the results into an Excel file. We would like the script to autosave this file to a specific directroy with the date ran as part of teh file name. We would then like these results to
    be emailed to us if possible. (also if possible to highlight cell in red that is 5% OR less available disk space would be great)
    Here is what we have:
    $erroractionpreference = “SilentlyContinue”
    $a = New-Object -comobject Excel.Application
    $a.visible = $True
    $b = $a.Workbooks.Add()
    $c = $b.Worksheets.Item(1)
    $c.Cells.Item(1,1) = “Machine Name”
    $c.Cells.Item(1,2) = “Drive”
    $c.Cells.Item(1,3) = “Total size (GB)”
    $c.Cells.Item(1,4) = “Free Space (GB)”
    $c.Cells.Item(1,5) = “Free Space (%)”
    $c.cells.item(1,6) = "Name "
    $d = $c.UsedRange
    $d.Interior.ColorIndex = 19
    $d.Font.ColorIndex = 11
    $d.Font.Bold = $True
    $d.EntireColumn.AutoFit()
    $intRow = 2
    $colComputers = get-content "C:\Servers.txt"
    foreach ($strComputer in $colComputers)
    $colDisks = get-wmiobject Win32_LogicalDisk -computername $strComputer -Filter “DriveType = 3"
    foreach ($objdisk in $colDisks)
    $c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
    $c.Cells.Item($intRow, 2) = $objDisk.DeviceID
    $c.Cells.Item($intRow, 3) = “{0:N0}” -f ($objDisk.Size/1GB)
    $c.Cells.Item($intRow, 4) = “{0:N0}” -f ($objDisk.FreeSpace/1GB)
    $c.Cells.Item($intRow, 5) = “{0:P0}” -f ([double]$objDisk.FreeSpace/[double]$objDisk.Size)
    $c.cells.item($introw, 6) = $objdisk.volumename
    $intRow = $intRow + 1
    $d.EntireColumn.AutoFit()
    cls
    Thank You

    Hi Phorbin1128,
    The script below amy be helpful for you to save the Excel file with date in filename, and send email with the attachment of the excel report.
    $erroractionpreference = “SilentlyContinue”
    $a = New-Object -comobject Excel.Application
    $a.visible = $True
    $b = $a.Workbooks.Add()
    $c = $b.Worksheets.Item(1)
    $c.Cells.Item(1,1) = “Machine Name”
    $c.Cells.Item(1,2) = “Drive”
    $c.Cells.Item(1,3) = “Total size (GB)”
    $c.Cells.Item(1,4) = “Free Space (GB)”
    $c.Cells.Item(1,5) = “Free Space (%)”
    $c.cells.item(1,6) = "Name "
    $d = $c.UsedRange
    $d.Interior.ColorIndex = 19
    $d.Font.ColorIndex = 11
    $d.Font.Bold = $True
    $d.EntireColumn.AutoFit()
    $intRow = 2
    $colComputers = get-content "C:\Servers.txt"
    foreach ($strComputer in $colComputers)
    $colDisks = get-wmiobject Win32_LogicalDisk -computername $strComputer -Filter “DriveType = 3"
    foreach ($objdisk in $colDisks)
    $c.Cells.Item($intRow, 1) = $strComputer.ToUpper()
    $c.Cells.Item($intRow, 2) = $objDisk.DeviceID
    $c.Cells.Item($intRow, 3) = “{0:N0}” -f ($objDisk.Size/1GB)
    $c.Cells.Item($intRow, 4) = “{0:N0}” -f ($objDisk.FreeSpace/1GB)
    $c.Cells.Item($intRow, 5) = “{0:P0}” -f ([double]$objDisk.FreeSpace/[double]$objDisk.Size)
    $c.cells.item($introw, 6) = $objdisk.volumename
    $intRow = $intRow + 1
    $d.EntireColumn.AutoFit()
    $date=Get-Date -f yyyy-MM-dd
    $filename = "D:\test\"+$date+".xlsx"
    $b.SaveAs($filename)
    $a.Quit()
    Send-MailMessage -SmtpServer xxxxxxxxxx -To [email protected] -From [email protected] -Subject "test mail" -Body "file name is: $new_file" -attachment $filename
    For more detailed information about the cmdlet Send-MailMessage, please refer to this article:
    Send-MailMessage
    I hope this helps.

  • How to use javascript to "save as" using form data in the file name

    I want to be able to use a button to "save as" and have it automatically pick up and use certain data from the fields in the file name. without having to manually type in the file name.
    Name: john doe
    Date: 1-25-13
    file name would be  (john doe 1-25-13)

    You will need two parts for this. A folder level script (which you place in a .js file under the JavaScripts folder of Acrobat), and a script embedded in the file itself (probably attached to a button).
    The folder-level script will look like this:
    var mySaveAs = app.trustedFunction( function(oDoc,cPath) {
        app.beginPriv();
        try {
            oDoc.saveAs(cPath);
        } catch(e){
            app.alert("Error During Save");
        app.endPriv();
    The doc-level script can look something like this (of course, you might need to adjust the names of the fields used):
    var filePath = this.path.replace(this.documentFileName, "");
    var newFileName = this.getField("name").valueAsString + " " + this.getField("date").valueAsString + ".pdf";
    mySaveAs(this, filePath+newFileName);
    You should be aware that several characters are not allowed in the file name, including comma's, forward- and back-slashes, line-breaks and excalmation marks, so if you try to use them the script would fail. It is possible to create a more advanced version of this script that will automatically remove such characters from the file-name, or alert the user if they used them.

  • CS6 Pshop - Alerts at startup; "All Readable Documents" not defaulting at opening; Format in file name not same as Format list when saving file

    Just downloaded CS6 Design Standard. System - OS10.6.8 (about to upgrade to 10.8), iMac 27 i5Intel 4core 12GBram 2.66Ghz
    As Pshop opens, I get three alerts...
    1 - Could not load Enable Async I/O module because does not work with this version of Photoshop
    2 - Could not load Multiprocessor Support module because does not work with this version of Photoshop
    3 - Could not load FastCore Routines module because does not work with this version of Photoshop
    Then asks if I want to be connected to internet or something like that. Then Pshop opens even before I click OK
    None of these happened with CS5.5
    I realize CS6 is 64bit. I have CS5.5 set at 32bit because of plugins.
    Two issues I've noticed so far with CS6.
    1 - As I open a document, the Enable selections drop down at bottom of window is not set on anything. I have to always select the All Readable Documents. Not the case in CS5.5 which was always default at All Readable Documents. Could not find anything in Prefs to this issue.
    2 - When saving a document, whether RGB or CMYK, the drop down Format selections are not accurate. The first three or four do read correctly as correlating with the suffix (.jpg .tif etc) in the file name at top of window. But then the subsequent format selections below third or fourth one read as the one above it in the list.
    eg: as RGB file: Saving through BMP indicates same in file name at top (.bmp). However, the next choice below that, Gif, still shows as .bmp in file name at top. And so on to bottom of list. Same with CMYK file.
    Never saw this in CS5.5.
    When I initially installed CS6, I noticed only item in the Plugins folder was Panels folder.... no other plugins. I thought this to be a download error of some sort and dragged basic plugins from 5.5 into 6 Plugins folder. Could this be the problem? Otherwise, I would have NO plugins in CS6
    I have downloaded CS6 twice now thinking the first was corrupted. I used both download options on Adobe page - Akamai and standard
    Same issues with both. One response stated this all to be a plugins problem. I have uninstalled "after market" plugins from both 5.5 & 6 SuperBladePro was the only one. Restarted CS6. Still same problems. Only items in Plugins are what came with program.

    I owe an apology to the previous responder Chris C, to this issue. I misread his solution thinking he meant I needed to delete ONLY the "additional" plugins like SBPro. Which I did. But rereading, I see he meant ALL the plugins I dragged from 5.5 because the 6 plugins folder was empty.
    I thought it was corrupted in download. So if you guys get points for solutions, be sure Chris gets a few since I responded saying it did not work.
    In fact, after removing the 5.5 plugins from 6, everything is working fine.
    Plus I didn't know the 6 plugin folder was for the "after markets" like SBPro which is good to know.
    Also thanks for the fairly quick response. I'm typically dubious about forums as troubleshooting solutions.
    Kinda like sending a message in a bottle out to sea. Never know when it's coming back.
    Sometimes issues are urgent. Your response team has encouraged me greatly  :-)
    But still bummed that Chats do not support CS6 however.

  • Date Repeats in file name coming back from plugins

    My filename date repeats when I edit the photos in plugins (NIK plugins) from within lightroom.  For example, if the file name is 20120402DescansoGardens and I edit in four different plugins, the file names comes back as 20120402-20120402-20120402-20120402-20120402DescansoGardens.  Does this happen to anyone else?

    Check your filename template in external editing prefs.

  • Date part in file name of backup file

    Hi,
    i want the datepart to be included in the file name of dump file which is a backup file of a schema. what i need is i want to know the approriate dos command which can be used in export utility , such that the file name should contain date part
    when i tried to do this by running the script
    EXP system/[email protected] file="c:\toniknvtest_%date%.dmp" owner=toniknvtest
    the dump is created with filename toniknvtest_wed where as i want "toniknvtest_wed_8_2_2006."
    pls correct the date part in the export command
    Thank you,
    Raj Deep.A

    Any Idea?! :-)
    D:\oracle\ora92\bin>cmd
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    D:\oracle\ora92\bin>set
    ALLUSERSPROFILE=C:\Documents and Settings\All Users
    APPDATA=C:\Documents and Settings\owner\Application Data
    CLIENTNAME=Console
    CommonProgramFiles=C:\Program Files\Common Files
    COMPUTERNAME=REZA
    ComSpec=C:\WINDOWS\system32\cmd.exe
    FP_NO_HOST_CHECK=NO
    HOMEDRIVE=C:
    HOMEPATH=\Documents and Settings\owner
    LOGONSERVER=\\REZA
    NUMBER_OF_PROCESSORS=1
    OS=Windows_NT
    Path=D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program F
    Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbe
    Program Files\Symantec\pcAnywhere\
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    PROCESSOR_ARCHITECTURE=x86
    PROCESSOR_IDENTIFIER=x86 Family 6 Model 13 Stepping 6, GenuineIntel
    PROCESSOR_LEVEL=6
    PROCESSOR_REVISION=0d06
    ProgramFiles=C:\Program Files
    PROMPT=$P$G
    SESSIONNAME=Console
    SystemDrive=C:
    SystemRoot=C:\WINDOWS
    TEMP=C:\DOCUME~1\owner\LOCALS~1\Temp
    TMP=C:\DOCUME~1\owner\LOCALS~1\Temp
    USERDOMAIN=REZA
    USERNAME=owner
    USERPROFILE=C:\Documents and Settings\owner
    WF_RESOURCES=D:\oracle\ora92\WF\RES\WFus.RES
    windir=C:\WINDOWS
    D:\oracle\ora92\bin>echo %date%
    Wed 02/08/2006
    D:\oracle\ora92\bin>Regards,
    Reza

Maybe you are looking for

  • Mac Mini & B&O Avant TV

    Hi: I need help with a connection. I have a B&O Avant TV and today bought a Mac Mini. I want to use the Avant as the display for the Mini. Using an Apple DVi to s-Video adaptor I have connected the Mini to the S-Video port on the Avant. When the Mini

  • Using an Air in tandem with an iMac

    What's the best way to keep my iMac and a new Air in sync? Mail is on Gmail, so that's covered. ITunes on iMatch, so that's covered. But photos? Can I duplicate iphoto identically on both machines and keep them the same? And what about documents? For

  • Reducing sftware sims for browser viewing?

    I hope this has already been hammered out by the elearning community. If I want to capture software interactions (stills and full motion), how should I do the captures, if I know that the movies will be previewed within an interface (flash, with cour

  • I want to turn on touch ID for iTunes & App Store

    When I try, the feature is grayed out. I looked at my settings for iTunes & App store and my Apple ID is entered and when I click it i have the option to 'sign out' so I believe I am signed in. Any ideas on how to enable this feature?

  • Error In LOV

    I have attached lov to a field and when i click the torch i get the following error oracle.apps.fnd.framework.OAException: The application id or shortname (common) you entered does not exist. where can the error be?