How to convert date to timestamp

82

Solution 1

man date will give you the details of how to use the date command.

To convert long date in standard format into Unix epoc time (%s): date -d '2012-03-22 22:00:05 EDT' +%s

Solution 2

MacOS - date -j -f "%Y:%m:%d %H:%M:%S" '2012:03:22 22:00:05' +%s

Share:
82

Related videos on Youtube

Nachiappan R
Author by

Nachiappan R

Updated on September 18, 2022

Comments

  • Nachiappan R
    Nachiappan R over 1 year

    I have tried two different update SQL query but facing the error:

    Warning: Null value is eliminated by an aggregate or other SET operation.

    And

    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.

    I don`t know where I am doing wrong?

    Please find the two queries below.

    Query One:

    update DB1..UScustomer 
    set area='India' 
    WHERE (customerid = '1') AND (area = 'US') 
      AND (areatransid in (select areaTransactionId 
                           from DB2..AllCustomer 
                           where area='US' and customerid='1' and statusId='2'))
    

    Query Two:

    update DB1..UScustomer 
    SET area='India' 
    from DB1..UScustomer M1 
    inner join DB2..AllCustomer M2 
          on M1.areatransid=S1.areaTransactionId and S1.statusId=2 
    WHERE (customerid = '1') AND (area = 'US')