Get weekday of DD/MM/YYYY

I thought I'd almost got here with this script
set ShotDate to do shell script "exiftool -s3 -DateTimeOriginal /Users/StudioA/Desktop/MJC_0025.JPG "
log ShotDate
set theYear to (characters 1 thru 4 of ShotDate) as text
set theMonth to (characters 6 thru 7 of ShotDate) as text
set theDay to (characters 9 thru 10 of ShotDate) as text
set myDate to (theDay & "/" & theMonth & "/" & theYear)
set thedate to date myDate
log thedate
weekday myDate
the date will show the day of the week in its format
(*date Thursday, 21 August 2014 00:00:00*)
but I can't then set the weekday to Thursday?
Result:
error "Can’t get weekday \"21/08/2014\"." number -1728 from weekday "21/08/2014"

Got it after a little trial and error
weekday of date myDate

Similar Messages

  • Get weekday number having date

    Hi SAPpers I have a code
    DATA: dayattr TYPE casdayattr OCCURS 0 WITH HEADER LINE.
    DATA: hcal LIKE scal-hcalid, fcal LIKE scal-fcalid.
    fcal = 'CZ'.
    hcal = 'CS'.
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
      EXPORTING
        factory_calendar = fcal
        holiday_calendar = hcal
        date_from        = '20071025'
        language         = sy-langu
      TABLES
        day_attributes   = dayattr.
    WRITE: / dayattr-weekday.
    I need to get weekday-number, but no matter which date I give to the function (date_from) it returns '1'. 20071025 is thursday, so I assume that dayattr-weekday should be '4' (or '5' if sunday is the first day). What am I doing wrong? Greetings

    Hi Piotr,
                 I am not sure based on what requirement you are using it but i just  tested the FM 'DAY_ATTRIBUTES_GET' in SE37 to get proper output i.e to get the day num' for the same i did some small changes as follows:
    <b>1.</b> <b>date_from</b> - here don't pass SAP format date instead give as <b>mm/dd/yyyy</b> format. Inorder to convert the SAP date format to mm/dd/yyyy use CONVERSION_EXIT_PDATE_OUTPUT FM i.e.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
        EXPORTING
          input  = <b>lv_date</b>    " say this has your date 20071025
        IMPORTING
          output = <b>lv_cdate</b>. " This wud have 10/25/2007
    <b>2. Also pass date_to value in the FM</b> with same date value
    CALL FUNCTION 'DAY_ATTRIBUTES_GET'
      EXPORTING
        factory_calendar = 'CZ'
        holiday_calendar = 'CS'
        date_from        = <b>lv_cdate</b>
        <b>date_to           = lv_cdate</b>
        language         = sy-langu
      TABLES
        day_attributes   = dayattr.
    WRITE: / dayattr-weekday. " I had value as 4 here
    If this answers your query inform me.
    Regards,
    Bharathy.

  • How to get date in dd/mm/yyyy format ?

    Hello,
    for this query :
    >select to_date(to_char(sysdate),'dd/mm/yyyy') from dual;
    i wanted to get date in dd/mm/yyyy format , but this query is not returning in correct date format .
    How to get that ?

    select id,
    to_date(to_char(dt1,'mm/dd/yyyy'),'dd/mm/yyyy') dt1,
    to_date(to_char(dt2,'mm/dd/yyyy'),'dd/mm/yyyy') dt2
    from t_table1 where no=23;This is my actual query.
    But this query is giving error.
    ORA-01843: not a valid monthWhen i issued this query :
    select id,dt1,dt2 from t_table1 where no=23 ;
    this is the output :
    ID DT1 DT2
    001 10/7/2011 10/19/2011Edited by: bootstrap on Oct 8, 2011 2:13 PM
    Edited by: bootstrap on Oct 8, 2011 2:13 PM

  • How can i get todays date as an yyyy-MM-dd format instead of Time stamp

    how can i get todays date as an yyyy-MM-dd format instead of Time stamp,i try to do it in the fallowing way
    <code>
    java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");
         java.util.Date d = new java.util.Date();
              String s = d+"";
    Calendar cal1 = Calendar.getInstance();
         try{
         cal1.setTime(sdf.parse(s));
    }catch(Exception e){}
    </code>
    but i could not able to get,it throws error as an java.text.ParseException: Unparseable date: "Thu Jan 24 11:43:32 EST 2002" ,pl suggest me any solution.any help would be appreciated.
    Regards.

    Does string s have to end with ""?
    Try doing sdf.format(d) instead.

  • Get date as dd-mm-yyyy in query

    Hi guys,
    I found a lot on date and times but i can't really find howe to integrate this into a query.
    For example, if i use a query like this:
    Select
    [db1].[dbo].[table1].[colomn1]
    I get the date and time back as datetime but i need only date (dd-mm-yyyy) and need it only in the query so don't want to change the db or table settings

    SELECT FORMAT(getdate(), 'dd-MM-yyyy')
    ps.sql server 2012 and onwards
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Disco+ not getting time component on format YYYY-MM-DD HH:MI:SS

    I have a problem with several fields that have an Oracle datatype of DATE, and which have a time component. Our installation is 10GR2. The first field is SEQ_START_TIME (names are changed to protect the innocent). Like the other fields under discussion, there is a time component, and I have verified that time is present using Oracle Enterprise Manager (e.g. 04-Oct-2006 02:47:27 AM ). I built the Business Intellligence items in OWB (about 100 items in 4 folders) and after being deployed to Discoverer Plus they are all working except showing the time component (only date appears). The format I have used in OWB, which was successfully deployed to Discoverer Plus is “YYYY-MM-DD HH:MI:SS”. I also tried changing the format in the workbook and to no avail.
    Any suggestions as to why Discoverer is not getting the time info? I have checked other similar postings but can't seem to solve it.
    ak

    Hi Russ. Thanks for your suggestion. The only NLS_ setting is as follows:
    nls_lang = AMERICAN_AMERICA.WE8MSWIN1252 and I believe that is character set. I looked elsewhere in the registry for Discoverer and found a couple of things but not NLS_ stuff or anything that seemed related. Do the Oracle product wizards monitor these sites? The way it is not working does seem like a setting/parameter/flag because it does give the correct date but displays the 12:00:00 time component as if none had been assigned.

  • How to get Dateformat as DD/MM/YYYY

    hi,
    I am facing problem in date display
    I want date in format dd/mm/yyyy like 04/05/2005
    I am using package in jsp page
    <%@ page import="java.util.Date" %>
    <td>
    <html:text property="startDate" size="10" maxlength="10" value='<%= new Date().toString() %>'/>
    DD/MM/YYYY
    </td>
    this is displaying date like "Wed May 04" in the text box
    I want when user open this page format of the date should be 04/05/2005 in the text box.
    please help me in this regard
    1904

    Or, if you're using tag libraries, use the JSTL fmt tag.
    <fmt:formatDate value="${someDate}" pattern="dd/MM/yyyy" />

  • How to get date in  mm/dd/yyyy hh:mm EST format

    Hi All,
    I want to display the sysdate in mm/dd/yyyy hh:mm EST format . Please help if anyone knows.

    try:
    SQL> alter session set nls_date_format ='mm/dd/yyyy hh:mi';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    10/15/2009 09:51or just:
    SQL> select to_char(sysdate, 'mm/dd/yyyy hh:mi') from dual;
    TO_CHAR(SYSDATE,
    10/15/2009 09:52Amiel

  • How to get weekday?

    Hello,
    i need to fill an caracteristic with weekday and for that i used a formula, DATE_WEEKDAY, in transfer rules. The problem is that formula returns weekday in lower case.
    Then i tried to create an abap rountine with module function DATE_TO_DAY and then translate weekday to upper case but BW system doesn't have this module function.
    Does anyone have this problem?
    Thanks
    Silvia

    Hi Siliva,
    Why don't you copy the Function Module(FM) DATE_TO_DAY into BW and create a custom FM? You could add your upper case code into the FM also. To do this, make you the text feilds all upper case instead of the mix of upper and lower case like it is currently.
    Cheers! Bill
    Message was edited by: Bill Faison

  • How To change the Date display format to dd.mm.yyyy format

    Hello friends
    I am expected to display the date fields in my BEx reports in the standard dd/mm/yy format. However, I find that it is getting displayed in mm/dd/yyyy form.
    This is creating a bit of a confusion for the client.
    Hence can someone please let me know, if I can make any change to the way the date is displayed in the reports.
    Looking for a prompt reply
    Thanks in advance
    regards
    Zubin Kurian

    Hi Zubin,
            There are some corrections in that coding.
    year = year+2(2).
    CONCATENATE day month year INTO l_date SEPERATED BY u2018/u2019.
    Regards,
    Yokesh.

  • Trasnform current date to format MM/dd/yyyy HH:mm:ss AM/PM

    Hi All,
    How do I transform current date to format MM/dd/yyyy HH:mm:ss AM/PM?
    I am able to get the format MM/dd/yyyy HH:mm:ss by using the standard date function. How do I get AM or PM to end of MM/dd/yyyy HH:mm:ss??
    Thanx
    Navin

    Hi Navin,
    How AM/PM is added? In the sample values given its in 24 hrs notation. Are u sure you want to add AM/PM to this notation? or U want to change this 24 hrs notation into 12 hrs and add AM/PM?
    For converting into 12 hrs and appending AM/PM you can use this code:
    input a:
    int hr = Integer.parseInt(a.substring(11,13));
    String appendVal = "AM";
    if(hr > 12){
       hr = hr - 12;
       appendVal = "PM";
    } else if(hr == 12){
       appendVal = "PM";
    } else if(hr == 00){
       hr = hr + 12;
    Sting finalVal = a.substring(0,11) + String.ValueOf(hr) + a.substring(13,a.length()) + appendVal;
    return finalVal;
    Regards,
    P.Venkat
    Message was edited by:
            Venkataramanan

  • Get-Date not calculating as expected

    I am trying to retrieve all the users in a specific OU of recently terminated users (who are temporarily being stored in a quarantine OU to abide by legal department's requirements to keep the mailboxes for 30 days).  Once I retrieve all the users I
    want to filter them into 3 buckets: 1) users with termination dates greater than 30 days, 2) users with term dates that are 30 days or less, 3) users with no term date listed.  Termination dates are populated into the "ExtentionAttribute7" field
    in the AD user object.  For some reason the output to a report does not correctly find the users greater than 30 and puts them all in the users less than 30 (we already corrected so that no users have empty fields).  Script is below:
    #Mail Server Variables
    $FromAddress = "[email protected]"
    $RelayMailServer = "relay.company.corp"
    $ITSupportEmailAddress = "[email protected]"
    $AdminNotifyAddress = "[email protected]"
    #Connect to Office 365
    $password = ConvertTo-SecureString "password" -AsPlainText -Force
    $cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList [email protected],$password
    $s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic -AllowRedirection
    $importresults = Import-PSSession $s
    $today = Get-Date -Format d
    # Define font and font size
    # ` or \ is an escape character in powershell
    $font = "<font size=`"3`" face=`"Calibri`">"
    #Headings used in the ITSupport Report
    $Title="<h1><u>Quarantined Users - Termination Ranges</h1></u><h4>Generated on " + $today + "</h4>"
    $Title_TermGreaterThan30="<h3><u>Users Have Termination Date that is 30 days or Older</h3></u>"
    $Title_TermLessThan30="<h3><u>Users Have Termination Date Less than 30 days</h3></u>"
    $Title_NoTermDate="<h3><u>Users Have No Termination Date Listed</h3></u>"
    $UsersList_TermGreaterThan30 = @()
    $UserList_TermLessThan30 = @()
    $UserList_NoTermDate = @()
    $usersUPNTermGreater30 = @()
    $usersUPNTermGreat30AD = @()
    $termDate = @()
    Get-ADUser -filter * -properties * -SearchBase 'ou=employees quarantine,dc=company,dc=corp' |
    ForEach {
    $termDate += Get-date $_.ExtensionAttribute7 -Format yyyy-MM-dd
    IF ($_.ExtensionAttribute7 -eq $null){
    #Add to User List
    $UserList_NoTermDate += $_.userprincipalname + "<br>"
    if (($_.extensionattribute7 -ne $null) -and ($termDate -lt (Get-Date).AddDays(-30)))
    #Add to UserLists
    $usersUPNTermGreater30 += $_.userprincipalname
    $usersUPNTermGreat30AD += $_.samaccountname
    $UsersList_TermGreaterThan30 += $_.userprincipalname + " " + "TermDate: " + $_.ExtensionAttribute7 + "</font> <br>"
    elseif ($_.extensionattribute7 -ne $null)
    #Add it to UserList
    $UserList_TermLessThan30 += $_.userprincipalname + " " + "TermDate: " + $_.extensionAttribute7 + "<br>"
    if (!$UsersList_TermGreaterThan30) {$UsersList_TermGreaterThan30 = "No Users to Report"}
    if (!$UserList_TermLessThan30) {$UserList_TermLessThan30 = "No Users to Report"}
    if (!$UserList_NoTermDate){$UserList_NoTermDate = "No Users to Report"}
    #Email Report to Admin
    $Subject="Quarantined Users Report for " + $today + "."
    $AdminReport = $font + $Title + $Title_TermGreaterThan30 + $UsersList_TermGreaterThan30 + $Title_TermLessThan30 + $UserList_TermLessThan30 + $Title_NoTermDate + $UserList_NoTermDate + "</font>"
    #Send-MailMessage -smtpServer $RelayMailServer -from $FromAddress -to $AdminEmailAddress -subject $Subject -BodyAsHtml -body $AdminReport
    #Send-MailMessage -smtpServer $RelayMailServer -from $FromAddress -to '[email protected]' -subject $Subject -BodyAsHtml -body $AdminReport
    Send-MailMessage -smtpServer $RelayMailServer -from $FromAddress -to '[email protected]' -subject $Subject -BodyAsHtml -body $AdminReport
    $results = @()
    ForEach ($user in $usersUPNTermGreater30){
    $results+=get-mailbox -identity $user -resultsize unlimited |`
    select UserPrincipalName }
    #Disable Litigation Hold
    Set-Mailbox -identity $user -LitigationHoldEnabled $false
    #Remove Archive Mailbox
    Disable-Mailbox -identity $user -Archive -confirm $false
    ForEach ($ADuser in $usersUPNTermGreat30AD){
    Get-ADUser $aDuser | Move-ADObject -TargetPath "OU=Employees Terminated,DC=company,DC=corp"
    If (!$usersUPNTermGreater30) { Write-Host "variable is null" }
    If ($usersUPNTermGreater30){$file = "c:\Office365\QuarantineLHDisable1.csv"}
    If ($usersUPNTermGreater30){$usersUPNTermGreater30 | Export-csv $file -NoTypeInformation}
    If($usersUPNTermGreater30){
    $msg = new-object Net.Mail.MailMessage
    $att = new-object Net.Mail.Attachment($file)
    $smtp = new-object Net.Mail.SmtpClient($RelayMailServer)
    $msg.From = "[email protected]"
    $msg.To.Add("[email protected]")
    #$msg.To.Add("[email protected]")
    $msg.Subject = "Quarantined Users Over 30 days - LH Disabled"
    $msg.Body = "Attached is the list of users who have been in the 'Employees Quarantine' OU for 30 days, where Litigation Hold and Archiving were disabled, as well as, users being moved to the Terminated OU."
    $msg.Attachments.Add($att)
    $msg.IsBodyHTML = $true
    $smtp.Send($msg)
    $att.Dispose()}
    Remove-PSSession $s
    #Clear all variables
    Clear-Variable user* -scope global
    Clear-variable term* -scope global

    I don't think that's the issue at least not all of it.  With that format switch on there...this is the $termdate output (and all the users go into the "less than 30 days" variable regardless of term date):
    PS C:\Windows\system32> $termDate
    2014-01-25
    2014-08-26
    2014-09-15
    2014-09-08
    2014-09-12
    2014-09-06
    2014-09-05
    2014-09-08
    2014-08-29
    2014-09-19
    2014-08-28
    2014-08-29
    2014-09-19
    2014-09-23
    2014-09-14
    2014-06-23
    2014-09-19
    2014-09-19
    2014-08-29
    2014-09-04
    2014-08-29
    2014-09-09
    2014-09-07
    2014-09-02
    2014-08-26
    2014-09-07
    2014-09-11
    2014-08-27
    When I take the format switch off...this is the output (and all the users go into the "greater
    than 30 days" variable regardless of term date): for $termdate:
    PS C:\Windows\system32> $termDate
    Saturday, January 25, 2014 12:00:00 AM
    Tuesday, August 26, 2014 12:00:00 AM
    Monday, September 15, 2014 12:00:00 AM
    Monday, September 08, 2014 12:00:00 AM
    Friday, September 12, 2014 12:00:00 AM
    Saturday, September 06, 2014 12:00:00 AM
    Monday, September 08, 2014 12:00:00 AM
    Friday, September 05, 2014 12:00:00 AM
    Friday, August 29, 2014 12:00:00 AM
    Friday, September 19, 2014 12:00:00 AM
    Thursday, August 28, 2014 12:00:00 AM
    Friday, August 29, 2014 12:00:00 AM
    Friday, September 19, 2014 12:00:00 AM
    Tuesday, September 23, 2014 12:00:00 AM
    Sunday, September 14, 2014 12:00:00 AM
    Monday, June 23, 2014 12:00:00 AM
    Friday, September 19, 2014 12:00:00 AM
    Friday, September 19, 2014 12:00:00 AM
    Friday, August 29, 2014 12:00:00 AM
    Thursday, September 04, 2014 12:00:00 AM
    Friday, August 29, 2014 12:00:00 AM
    Tuesday, September 09, 2014 12:00:00 AM
    Sunday, September 07, 2014 12:00:00 AM
    Tuesday, September 02, 2014 12:00:00 AM
    Tuesday, August 26, 2014 12:00:00 AM
    Sunday, September 07, 2014 12:00:00 AM
    Thursday, September 11, 2014 12:00:00 AM
    Wednesday, August 27, 2014 12:00:00 AM

  • Get lines starting with a specific word and export it in csv

    Hello,
    I have a text file of an application that sometimes goes in error.
    When the error occurs we have something like that:
    12/08/2013 21:36:15 - ERREUR     12/08/2013 21:36:15 - erreur open connexion : -2147467259 !! [IBM][CLI Driver] SQL30081N  Erreur de communication détectée.  Protocole : "TCP/IP".  API de communication
    utilisée : "SOCKETS".  Emplacement dans lequel l'erreur a été détectée : "192.168.1.15".  Fonction de communication détectant l'erreur : "selectForConnectTimeout".  Codes d'erreur spécifiques du protocole : "0",
    "*", "*".  SQLSTATE=08001
    12/08/2013 21:36:15 -  Machine : testVm
    12/08/2013 21:36:15 - ERREUR     12/08/2013 21:36:15 - erreur select repertoire : 3704 !! Cette opération n'est pas autorisée si l'objet est fermé. !! SELECT  distinct rep_inter, rep_transfert From exploit.rep WHERE  
    type_rep = 'E'   and machine = 'testvm' ORDER BY rep_inter,rep_transfert;
    12/08/2013 21:36:15 - ERR     12/08/2013 21:36:15 pb trait_repertoire
    12/08/2013 21:36:15 - Fin de session
    Yes, the message is in French :)
    That I need, is to read the file and search the ERREUR and then, include the message until the "Fin de session"
    (including the date and the hour that the error occurred).
    I tried this command: get-content .\error_Log.txt |Select-String "ERR" -SimpleMatch |
    export-csv .\ERREURS-$(Get-Date -Format dd-MMMM-yyyy-HH-mm-ss).csv
    But it is catastrophic!!!
    The output that i'd like to have is:
    DATE - HOUR - message error in three collumns of a CSV file.
    Note: In the middle of the message there is a BLANK line, it is normal.
    Any ideas will be welcome.
    thank you in advance.

    Hi,
    thanks for answering....your script does partially that I need.
    I explain: The output is in three columns but the error message is truncated, that is to say, I don't have the message entirely. To explain you, in the example above, when I generate the CSV file, the part ""192.168.1.15".  Fonction de communication
    détectant l'erreur : "selectForConnectTimeout".  Codes d'erreur spécifiques du protocole : "0", "*", "*".  SQLSTATE=08001"
    is missing...it goes directly to the line "12/08/2013 21:36:15 - ERREUR     12/08/2013 21:36:15 - erreur select repertoire : 3704 !!".
    Also that I need is to remove the double date-hour that appears in the same line.
    Thanks once again!

  • DD-MON-YY  to MM/DD/YYYY

    Hi ,
    I have data like '20080502' and it has to insert into a character field with the formart 'MM/DD/YYYY'
    Right now using a statement like " select to_date(to_char('20080502'),'yyyy/mm/dd') from dual"
    But, i got the output as 'DD-MON-YY'.
    How to get a format ' MM/DD/YYYY' without changing NLS_DATE_FORMAT
    Thanks

    if your literal is in datatype of characters try converting them to date then bringing them back to charater datatype with the format you needed.
      SQL> select to_char(to_date('20080502','yyyymmdd'),'mm/dd/yyyy') new_dt
        2   from dual;
      NEW_DT
      05/02/2008
      SQL>

  • Converting date from DD.MM.YYYY  to  YYYY - MM - DD  format

    Hi All,
    Can you give me a way to convert date from DD.MM.YYYY  to  YYYY - MM - DD  format. Actually frm tables i am getting date in DD.MM.YYYY format.  And i want to print it in YYYY-MM-DD format.
    Please reply.
    Thanks And Regards,
    Mayank Verma
    Moderator message - Please search before asking. Date formatting is one of the most common questions asked - post locked
    Edited by: Rob Burbank on Jul 6, 2009 10:42 AM

    Hi,
    Hey you can make use of offset  and concatenate statement to convert the date.
    regards,
    Ankur Parab

Maybe you are looking for